Class NumberIntervalFormValidator
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.runtime.parameter.DefaultValidator
org.ametys.plugins.forms.question.validators.AbstractIntervalFormValidator<Number>
org.ametys.plugins.forms.question.validators.NumberIntervalFormValidator
- All Implemented Interfaces:
Validator
,PluginAware
,Configurable
,LogEnabled
,Serviceable
A number interval form validator
-
Field Summary
Fields inherited from class org.ametys.plugins.forms.question.validators.AbstractIntervalFormValidator
_max, _min
Fields inherited from class org.ametys.runtime.parameter.DefaultValidator
_invalidText, _isMandatory, _pluginName, _regexp, _smanager
-
Constructor Summary
ConstructorDescriptionNumberIntervalFormValidator
(String regexp, boolean mandatory, Number min, Number max) The constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addIntervalError
(Errors errors, Number min, Number max) Add an error when the max value is less than the min valueprotected boolean
isLessThan
(Number value, Number min) Test if the first number is less than the second one.protected boolean
isMoreThan
(Number value, Number max) Test if the first number is more than the second one.Methods inherited from class org.ametys.plugins.forms.question.validators.AbstractIntervalFormValidator
validateArrayValues, validateSingleValue
Methods inherited from class org.ametys.runtime.parameter.DefaultValidator
configure, equals, getConfiguration, hashCode, service, setPluginInfo, validate
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Constructor Details
-
NumberIntervalFormValidator
The constructor- Parameters:
regexp
- the regexpmandatory
- mandatorymin
- the min valuemax
- the max value
-
-
Method Details
-
isLessThan
Description copied from class:AbstractIntervalFormValidator
Test if the first number is less than the second one.- Specified by:
isLessThan
in classAbstractIntervalFormValidator<Number>
- Parameters:
value
- The first number to compare.min
- The second number to compare.- Returns:
- true if the first number is less than the first, false otherwise.
-
isMoreThan
Description copied from class:AbstractIntervalFormValidator
Test if the first number is more than the second one.- Specified by:
isMoreThan
in classAbstractIntervalFormValidator<Number>
- Parameters:
value
- The first number to compare.max
- The second number to compare.- Returns:
- true if the first number is more than the first, false otherwise.
-
addIntervalError
Description copied from class:AbstractIntervalFormValidator
Add an error when the max value is less than the min value- Specified by:
addIntervalError
in classAbstractIntervalFormValidator<Number>
- Parameters:
errors
- The list of errorsmin
- The min valuemax
- The max value
-