Class DateTimeIntervalFormValidator
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.runtime.parameter.DefaultValidator
org.ametys.plugins.forms.question.validators.AbstractIntervalFormValidator<ZonedDateTime>
org.ametys.plugins.forms.question.validators.DateTimeIntervalFormValidator
- All Implemented Interfaces:
Validator
,PluginAware
,Configurable
,LogEnabled
,Serviceable
A date time 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
ConstructorsConstructorDescriptionDateTimeIntervalFormValidator
(String regexp, boolean mandatory, ZonedDateTime min, ZonedDateTime max) The constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addIntervalError
(Errors errors, ZonedDateTime min, ZonedDateTime max) Add an error when the max value is less than the min valueprotected boolean
isLessThan
(ZonedDateTime dateToValidate, ZonedDateTime dateMin) Test if the first number is less than the second one.protected boolean
isMoreThan
(ZonedDateTime dateToValidate, ZonedDateTime 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
-
DateTimeIntervalFormValidator
public DateTimeIntervalFormValidator(String regexp, boolean mandatory, ZonedDateTime min, ZonedDateTime 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<ZonedDateTime>
- 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<ZonedDateTime>
- 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.
-
addIntervalError
Description copied from class:AbstractIntervalFormValidator
Add an error when the max value is less than the min value- Specified by:
addIntervalError
in classAbstractIntervalFormValidator<ZonedDateTime>
- Parameters:
errors
- The list of errorsmin
- The min valuemax
- The max value
-