Class DecimalDigitsValidatorImpl
java.lang.Object
ch.tocco.nice2.validate.api.validators.AbstractValidator
ch.tocco.nice2.validate.api.validators.DecimalDigitsValidatorImpl
- All Implemented Interfaces:
DecimalDigitsValidator, Validator, ValueValidator, Cloneable
-
Nested Class Summary
Nested classes/interfaces inherited from interface Validator
Validator.MergeMode -
Field Summary
Fields inherited from class AbstractValidator
doContinue, level, name, negate, runOn -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FieldValidationResultbooleanTells if the constraint data of this validator can be merged with another instance.clone()static DecimalDigitsValidatorImplstatic DecimalDigitsValidatorImplstatic DecimalDigitsValidatorImplstatic DecimalDigitsValidatorImplintintClass<? extends ValueValidator> getType()protected booleanIf subclass overwrites and returns true then the validate() method won't do it anymore.voidinit(int prePointDigits, int decimalDigits) booleanmergeConstraints(Validator validator, Validator.MergeMode mode) Default implementation so that subclasses are only forced to override canMergeConstraints().Methods inherited from class AbstractValidator
doContinueOnFailure, doNegate, getErrorStatusByLevel, getLevel, getName, getRunOn, hasName, isEmptySoIgnore, negateResultIfNeeded, setContinue, setLevel, setName, setNegate, setRunOn, validate
-
Constructor Details
-
DecimalDigitsValidatorImpl
public DecimalDigitsValidatorImpl() -
DecimalDigitsValidatorImpl
public DecimalDigitsValidatorImpl(int prePointDigits, int postPointDigits)
-
-
Method Details
-
createIntegerValidator
-
createLongValidator
-
createByteValidator
-
createShortValidator
-
init
public void init(int prePointDigits, int decimalDigits) - Specified by:
initin interfaceDecimalDigitsValidator
-
getPostPointDigits
public int getPostPointDigits()- Specified by:
getPostPointDigitsin interfaceDecimalDigitsValidator- Returns:
- The number of decimal digits maximally allowed.
-
getPrePointDigits
public int getPrePointDigits()- Specified by:
getPrePointDigitsin interfaceDecimalDigitsValidator
-
_validate
protected FieldValidationResult _validate(Object value, Map<String, Object> fields) throws IllegalArgumentException- Specified by:
_validatein classAbstractValidator- Throws:
IllegalArgumentException
-
iNegateMyself
protected boolean iNegateMyself()Description copied from class:AbstractValidatorIf subclass overwrites and returns true then the validate() method won't do it anymore. That's preferred for implementing validators (not groups).- Overrides:
iNegateMyselfin classAbstractValidator- See Also:
-
canMergeConstraints
public boolean canMergeConstraints()Description copied from interface:ValidatorTells if the constraint data of this validator can be merged with another instance.This is validator-type specific. For example a date range validator can, a regex validator obviously cannot.
- Specified by:
canMergeConstraintsin interfaceValidator- See Also:
-
mergeConstraints
Description copied from class:AbstractValidatorDefault implementation so that subclasses are only forced to override canMergeConstraints().- Specified by:
mergeConstraintsin interfaceValidator- Overrides:
mergeConstraintsin classAbstractValidator- Parameters:
validator- The validator to merge in.mode- How to merge.- Returns:
trueif it was done. This should only fail if canMergeConstraints() says false.- See Also:
-
getType
-
clone
- Specified by:
clonein interfaceValidator- Overrides:
clonein classAbstractValidator- Throws:
CloneNotSupportedException
-