Class ValidatorTemporalBefore<V>
- java.lang.Object
-
- io.github.mmm.validation.AbstractValidator<V>
-
- io.github.mmm.validation.AbstractValueValidator<V>
-
- io.github.mmm.validation.temporal.ValidatorTemporalBefore<V>
-
- Type Parameters:
V
- is the generic type of the value tovalidate
.
- All Implemented Interfaces:
Composable<Validator<?>>
,Validator<V>
,Iterable<Validator<?>>
- Direct Known Subclasses:
ValidatorInstantBefore
,ValidatorLocalDateBefore
,ValidatorLocalDateTimeBefore
,ValidatorLocalTimeBefore
,ValidatorOffsetDateTimeBefore
,ValidatorOffsetTimeBefore
,ValidatorZonedDateTimeBefore
public abstract class ValidatorTemporalBefore<V> extends AbstractValueValidator<V>
- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
ID
-
Fields inherited from interface io.github.mmm.validation.Validator
ID_MANDATORY
-
-
Constructor Summary
Constructors Constructor Description ValidatorTemporalBefore(Supplier<V> valueSource)
The constructor.ValidatorTemporalBefore(V value)
The constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getId()
AbstractValidator
only provides a default implementation of this method.
ATTENTION:
This default implementation returns thesimple class name
of the actualValidator
implementation.Object
getMax()
int
hashCode()
protected abstract boolean
isBefore(V value, V limit)
boolean
isDynamic()
This method determines if thisValidator
is dynamic.protected NlsMessage
validateNotNull(V value)
This method performs the validation in casevalue
is NOTnull
.-
Methods inherited from class io.github.mmm.validation.AbstractValueValidator
validate, validateNull
-
Methods inherited from class io.github.mmm.validation.AbstractValidator
source2string, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.base.lang.Composable
getChild, getChildCount, iterator
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface io.github.mmm.validation.Validator
append, append, containsId, getMin, isMandatory, validate
-
-
-
-
Field Detail
-
ID
public static final String ID
- See Also:
getId()
, Constant Field Values
-
-
Constructor Detail
-
ValidatorTemporalBefore
public ValidatorTemporalBefore(Supplier<V> valueSource)
The constructor.- Parameters:
valueSource
- theSupplier
of the value to compare to.
-
ValidatorTemporalBefore
public ValidatorTemporalBefore(V value)
The constructor.- Parameters:
value
- the value to compare to.
-
-
Method Detail
-
isDynamic
public boolean isDynamic()
Description copied from class:AbstractValidator
This method determines if thisValidator
is dynamic. Here dynamic means that the validation of the same input may not always return the same validation result (e.g. it holds references to instances that have dynamic impact on the validation).- Overrides:
isDynamic
in classAbstractValidator<V>
- Returns:
true
if thisValidator
is dynamic,false
otherwise.
-
getId
public String getId()
Description copied from class:AbstractValidator
AbstractValidator
only provides a default implementation of this method.
ATTENTION:
This default implementation returns thesimple class name
of the actualValidator
implementation. This strategy is chosen for simplicity when implementing a newValidator
. To ensure stable IDs override this method and return a string constant. This shall at least be done when the name of the class is changed to provide backwards compatibility.- Specified by:
getId
in interfaceValidator<V>
- Overrides:
getId
in classAbstractValidator<V>
- Returns:
- the identifier of this
Validator
. - See Also:
ValidationResult.getCode()
-
validateNotNull
protected NlsMessage validateNotNull(V value)
Description copied from class:AbstractValueValidator
This method performs the validation in casevalue
is NOTnull
. This method contains the actual custom logic for the validation. It is therefore designed in a way that makes it most simple to implement custom validators.- Specified by:
validateNotNull
in classAbstractValueValidator<V>
- Parameters:
value
- the value to validate.- Returns:
- the
failure message
ornull
if the the givenvalue
is valid.
-
isBefore
protected abstract boolean isBefore(V value, V limit)
- Parameters:
value
- the date to check.limit
- the upper bound to compare to.- Returns:
true
ifvalue
is beforelimit
,false
otherwise.
-
getMax
public Object getMax()
- Returns:
- the maximum allowed value. Typically of type <V> but this can not be guaranteed.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractValidator<V>
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classAbstractValidator<V>
-
-