Class LocalDateIntervalFormValidator
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.runtime.parameter.DefaultValidator
org.ametys.plugins.forms.question.validators.AbstractIntervalFormValidator<LocalDate>
org.ametys.plugins.forms.question.validators.LocalDateIntervalFormValidator
- All Implemented Interfaces:
Validator
,PluginAware
,Configurable
,LogEnabled
,Serviceable
A local date 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
ConstructorDescriptionLocalDateIntervalFormValidator
(String regexp, boolean mandatory, LocalDate min, LocalDate max) The constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected I18nizableText
getIntervalError
(LocalDate min, LocalDate max) Retrieves the error when the max value is less than the min valueprotected boolean
isLessThan
(LocalDate dateToValidate, LocalDate dateMin) Test if the first number is less than the second one.protected boolean
isMoreThan
(LocalDate dateToValidate, LocalDate dateMax) 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
-
LocalDateIntervalFormValidator
public LocalDateIntervalFormValidator(String regexp, boolean mandatory, LocalDate min, LocalDate max) 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<LocalDate>
- Parameters:
dateToValidate
- The first number to compare.dateMin
- 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<LocalDate>
- Parameters:
dateToValidate
- The first number to compare.dateMax
- The second number to compare.- Returns:
- true if the first number is more than the first, false otherwise.
-
getIntervalError
Description copied from class:AbstractIntervalFormValidator
Retrieves the error when the max value is less than the min value- Specified by:
getIntervalError
in classAbstractIntervalFormValidator<LocalDate>
- Parameters:
min
- The min valuemax
- The max value- Returns:
- the interval error message
-