net.sf.springlayout.web.validator
Class DecimalValidator

java.lang.Object
  extended by net.sf.springlayout.web.validator.AbstractValidationRule
      extended by net.sf.springlayout.web.validator.DecimalValidator
All Implemented Interfaces:
ValidationRule

public class DecimalValidator
extends AbstractValidationRule

Provides type validation for decimals with the ability to specify a maxuimum number of decimal places

Author:
Rob Monie

Constructor Summary
DecimalValidator()
           
 
Method Summary
 java.lang.String getJavascript()
          Get the javascript used to validate this rule
 int getMaxDecimalPlaces()
           
 boolean isValid(java.lang.Object obj, java.lang.String fieldKey)
          As with the validate method, if it gets this far then the field value must be valid.
 void setMaxDecimalPlaces(int maxDecimalPlaces)
          Specify the max number of decimal places to test for.
 void validate(javax.servlet.http.HttpServletRequest request, java.lang.Object obj, org.springframework.validation.Errors errors, java.lang.String fieldKey)
          This method is not implemented as valdiating of types is taken care of through the binding process.
 
Methods inherited from class net.sf.springlayout.web.validator.AbstractValidationRule
conditionallyValidate, getCondition, getConditionalJavascript, getFieldValue, setCondition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecimalValidator

public DecimalValidator()
Method Detail

getMaxDecimalPlaces

public int getMaxDecimalPlaces()
Returns:
the maxDecimalPlaces

setMaxDecimalPlaces

public void setMaxDecimalPlaces(int maxDecimalPlaces)
Specify the max number of decimal places to test for. Default is 0

Parameters:
maxDecimalPlaces - the maxDecimalPlaces to set

validate

public void validate(javax.servlet.http.HttpServletRequest request,
                     java.lang.Object obj,
                     org.springframework.validation.Errors errors,
                     java.lang.String fieldKey)
This method is not implemented as valdiating of types is taken care of through the binding process. If the value of this field is not of type Integer then it will never get here.

Specified by:
validate in class AbstractValidationRule
See Also:
net.sf.springlayout.web.validator.ValidationRule#validate(javax.servlet.http.HttpServletRequest, java.lang.Object, org.springframework.validation.Errors, java.lang.String)

isValid

public boolean isValid(java.lang.Object obj,
                       java.lang.String fieldKey)
As with the validate method, if it gets this far then the field value must be valid.

Returns:
See Also:
ValidationRule.isValid(java.lang.Object, java.lang.String)

getJavascript

public java.lang.String getJavascript()
Description copied from class: AbstractValidationRule
Get the javascript used to validate this rule

Specified by:
getJavascript in class AbstractValidationRule
Returns:


Copyright © 2005-2007 Spring Layout Team. All Rights Reserved.