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
This is the abstract base class all
Validator implementations should extend.- Since:
- 1.0.0
-
Field Summary
Fields inherited from interface io.github.mmm.validation.Validator
ID_MANDATORY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanValidator<?> getChild(int index) intgetId()AbstractValidatoronly provides a default implementation of this method.
ATTENTION:
This default implementation returns thesimple class nameof the actualValidatorimplementation.inthashCode()booleanThis method determines if thisValidatoris dynamic.protected Stringsource2string(Object source) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.mmm.base.lang.Composable
iteratorMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AbstractValidator
public AbstractValidator()The constructor.
-
-
Method Details
-
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. -
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.
-
getChildCount
public int getChildCount()- Specified by:
getChildCountin interfaceComposable<V>
-
getChild
- Specified by:
getChildin interfaceComposable<V>
-
source2string
- Parameters:
source- thevalue source.- Returns:
- the
string representationof the givensource.
-
hashCode
public int hashCode() -
equals
-
toString
-