- 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 allValidator
implementations 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 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.int
hashCode()
boolean
isDynamic()
This method determines if thisValidator
is dynamic.protected String
source2string(Object source)
String
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, getMax, getMin, isMandatory, validate, validate
-
-
-
-
Method Detail
-
getId
public String getId()
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>
- Returns:
- the identifier of this
Validator
. - See Also:
ValidationResult.getCode()
-
isDynamic
public boolean isDynamic()
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).- Returns:
true
if thisValidator
is dynamic,false
otherwise.
-
source2string
protected String source2string(Object source)
- Parameters:
source
- thevalue source
.- Returns:
- the
string representation
of the givensource
.
-
-