V
- is the generic type of the value to validate
.public abstract class AbstractValueValidator<V> extends AbstractValidator<V>
ValueValidator
.PROPERTY_MANDATORY, PROPERTY_MAXIMUM, PROPERTY_MINIMUM
Constructor and Description |
---|
AbstractValueValidator()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
ValidationFailure |
validate(V value,
Object valueSource)
This method validates the given
value . |
protected abstract NlsMessage |
validateNotNull(V value)
This method performs the validation in case
value is NOT null . |
protected NlsMessage |
validateNull()
This method performs the validation in case
null was provided as value. |
append, contains, createBundle, equals, getCode, getProperty, hashCode, isDynamic, isMandatory, validate
public ValidationFailure validate(V value, Object valueSource)
ValueValidator
value
.value
- is the value to validate.valueSource
- is the source
describing the origin of the given
value
. This may be the filename where the value was read from, an XPath where the value was located
in an XML document, the label of a widget of the UI containing the value, etc. This will help to find the
problem easier. The source needs to have a reasonable string-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 a String
.ValidationFailure
or null
if the given value
is valid according to this
ValueValidator
.protected NlsMessage validateNull()
null
was provided as value. By default null
should be
considered as a legal value. Only for validators such as ValidatorMandatory
this method should be
overridden.failure message
or null
if the null
-value is
valid.protected abstract NlsMessage validateNotNull(V value)
value
is NOT null
. 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. NlsMessage
instead.value
- is the value to validate.failure message
or null
if the the given value
is valid.Copyright © 2001–2016 mmm-Team. All rights reserved.