- 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<?>>
- Direct Known Subclasses:
AbstractValidatorRange
,ValidatorCompare
,ValidatorEmail
,ValidatorEmailSpec
,ValidatorHost
,ValidatorHostName
,ValidatorIpAddress
,ValidatorIpV4Address
,ValidatorIpV6Address
,ValidatorMandatory
,ValidatorPasswordConfirmation
,ValidatorPattern
,ValidatorPhoneNumber
,ValidatorTemporalAfter
,ValidatorTemporalBefore
,ValidatorTemporalFuture
,ValidatorTemporalPast
public abstract class AbstractValueValidator<V> extends AbstractValidator<V>
This is the abstract base implementation ofValidator
.- Since:
- 1.0.0
-
-
Field Summary
-
Fields inherited from interface io.github.mmm.validation.Validator
ID_MANDATORY
-
-
Constructor Summary
Constructors Constructor Description AbstractValueValidator()
The constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ValidationResult
validate(V value, Object valueSource)
This method validates the givenvalue
.protected abstract Localizable
validateNotNull(V value)
This method performs the validation in casevalue
is NOTnull
.protected Localizable
validateNull()
This method performs the validation in casenull
was provided as value.-
Methods inherited from class io.github.mmm.validation.AbstractValidator
equals, getId, hashCode, isDynamic, 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, getMax, getMin, isMandatory, validate
-
-
-
-
Method Detail
-
validate
public ValidationResult validate(V value, Object valueSource)
Description copied from interface:Validator
This method validates the givenvalue
.- Parameters:
value
- is the value to validate.valueSource
- is thesource
describing the origin of the givenvalue
. The source needs to have a reasonablestring-representation
as 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
protected Localizable validateNull()
This method performs the validation in casenull
was provided as value. By defaultnull
should be considered as a legal value. Only for validators such asmandatory validator
this method should be overridden.- Returns:
- the
failure message
ornull
ifnull
is valid.
-
validateNotNull
protected abstract Localizable validateNotNull(V value)
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.- Parameters:
value
- the value to validate.- Returns:
- the
failure message
ornull
if the the givenvalue
is valid.
-
-