org.loom.validator
Class NumberValidator
java.lang.Object
org.loom.validator.AbstractPropertyValidator
org.loom.validator.NumberValidator
- All Implemented Interfaces:
- FormInputDecorator, PropertyValidator
public class NumberValidator
- extends AbstractPropertyValidator
Class that contains data and behaviour to validate one field.
This class and its descendants are thread-safe.
Methods inherited from class org.loom.validator.AbstractPropertyValidator |
getMessagePrefix, getOverridenMessageKey, getPropertyPath, isBindMessages, isValidateCollectionContainer, pushPropertyPath, setBindMessages, setMessagePrefix, setOverridenMessageKey, setPropertyPath, setValidateCollectionContainer, validateCollectionContainer |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
NumberValidator
public NumberValidator()
validate
public void validate(ValidationRequest request,
java.lang.Object v)
- Validates one input value and adds to errors any validation error found
- Parameters:
v
- the value to validate
decorate
public void decorate(FormInputTag t)
- Description copied from class:
AbstractPropertyValidator
- Add attributes to the tag based on this Validator instance metadata
- Specified by:
decorate
in interface FormInputDecorator
- Overrides:
decorate
in class AbstractPropertyValidator
- Parameters:
t
- the tag to be modified
isExcludeMax
public boolean isExcludeMax()
setExcludeMax
public void setExcludeMax(boolean excludeMax)
isExcludeMin
public boolean isExcludeMin()
setExcludeMin
public void setExcludeMin(boolean excludeMin)
getPrecision
public java.lang.Integer getPrecision()
getScale
public java.lang.Integer getScale()
setPrecision
public void setPrecision(java.lang.Integer precision)
setScale
public void setScale(java.lang.Integer scale)
setMaxValue
public void setMaxValue(java.math.BigDecimal maxValue)
setMinValue
public void setMinValue(java.math.BigDecimal minValue)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
getMaxValue
public java.math.BigDecimal getMaxValue()
getMinValue
public java.math.BigDecimal getMinValue()
getMaxLength
public java.lang.Integer getMaxLength()
- Calculates the maxlength using the precision and max and min values specified
- Returns:
- null if it cannot be calculated, else the expected maxlength including possible
minus sign and decimal dot.