java.lang.Object
io.github.mmm.validation.AbstractValidator<V>
io.github.mmm.validation.AbstractValueValidator<V>
- Type Parameters:
V- type of the value tovalidate.
- All Implemented Interfaces:
Composable<Validator<?>>,Validator<V>,Iterable<Validator<?>>
This is the abstract base implementation of
Validator.- Since:
- 1.0.0
-
Field Summary
Fields inherited from interface io.github.mmm.validation.Validator
ID_MANDATORY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method validates the givenvalue.protected abstract LocalizablevalidateNotNull(V value) This method performs the validation in casevalueis NOTnull.protected LocalizableThis method performs the validation in casenullwas provided as value.Methods inherited from class io.github.mmm.validation.AbstractValidator
equals, getChild, getChildCount, getId, hashCode, isDynamic, source2string, toStringMethods 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, spliteratorMethods inherited from interface io.github.mmm.validation.Validator
append, append, containsId, getChild, getMax, getMin, getRange, isMandatory, validate
-
Constructor Details
-
AbstractValueValidator
public AbstractValueValidator()The constructor.
-
-
Method Details
-
validate
Description copied from interface:ValidatorThis method validates the givenvalue.- Parameters:
value- is the value to validate.valueSource- is thesourcedescribing the origin of the givenvalue. The source needs to have a reasonablestring-representationas this may be displayed to the end-user to locate the source of the failure. In most cases it is suitable to directly pass aString.- Returns:
- the
ValidationResult.
-
validateNull
This method performs the validation in casenullwas provided as value. By defaultnullshould be considered as a legal value. Only for validators such asmandatory validatorthis method should be overridden.- Returns:
- the
failure messageornullifnullis valid.
-
validateNotNull
This method performs the validation in casevalueis 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.- Parameters:
value- the value to validate.- Returns:
- the
failure messageornullif the the givenvalueis valid.
-