- java.lang.Object
-
- io.github.mmm.validation.AbstractValidator<V>
-
- Type Parameters:
V- is the generic type of the value tovalidate.
- All Implemented Interfaces:
Composable<Validator<?>>,Validator<V>,Iterable<Validator<?>>
- Direct Known Subclasses:
AbstractComposedValidator,AbstractValueValidator
public abstract class AbstractValidator<V> extends Object implements Validator<V>
This is the abstract base class allValidatorimplementations should extend.- Since:
- 1.0.0
-
-
Field Summary
-
Fields inherited from interface io.github.mmm.validation.Validator
ID_MANDATORY
-
-
Constructor Summary
Constructors Constructor Description AbstractValidator()The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)StringgetId()AbstractValidatoronly provides a default implementation of this method.
ATTENTION:
This default implementation returns thesimple class nameof the actualValidatorimplementation.inthashCode()booleanisDynamic()This method determines if thisValidatoris dynamic.protected Stringsource2string(Object source)StringtoString()-
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, getMax, getMin, isMandatory, validate, validate
-
-
-
-
Method Detail
-
getId
public String getId()
AbstractValidatoronly provides a default implementation of this method.
ATTENTION:
This default implementation returns thesimple class nameof the actualValidatorimplementation. 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:
getIdin interfaceValidator<V>- Returns:
- the identifier of this
Validator. - See Also:
ValidationResult.getCode()
-
isDynamic
public boolean isDynamic()
This method determines if thisValidatoris 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).- Returns:
trueif thisValidatoris dynamic,falseotherwise.
-
source2string
protected String source2string(Object source)
- Parameters:
source- thevalue source.- Returns:
- the
string representationof the givensource.
-
-