V - is the generic type of the value to validate.public interface ValueValidator<V>
ValueValidator allows to validate according values. exceptions as they are expensive to produce
and shall only occur in exceptional situations, while a validation failure is a regular use-case. Further,
a validation shall validate entire objects to the end collecting all failures so
the end-user can see and fix all problems at once.| Modifier and Type | Method and Description |
|---|---|
ValidationFailure |
validate(V value)
This method validates the given
value. |
ValidationFailure |
validate(V value,
Object valueSource)
This method validates the given
value. |
ValidationFailure validate(V value)
value.value - is the value to validate.ValidationFailure or null if the given value is valid
according to this ValueValidator.ValidationFailure validate(V value, Object valueSource)
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.Copyright © 2001–2015 mmm-Team. All rights reserved.