V - is the generic type of the value to validate.public class ComposedValidator<V> extends AbstractValidator<V>
ValueValidator that is composed out of a set of individual
validators given at construction. It will
always invoke all contained validators when a validation is performed.| Modifier and Type | Field and Description |
|---|---|
private static String |
CODE |
private AbstractValidator<? super V>[] |
validators
The child validators.
|
| Constructor and Description |
|---|
ComposedValidator(AbstractValidator<? super V>... validators)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getCode()
This is the default implementation to retrieve the
code of this
ValueValidator. |
ValueValidator<? super V> |
getValidator(int index)
Gets the
ValueValidator at the given index. |
int |
getValidatorCount() |
boolean |
isMandatory() |
ValidationFailure |
validate(V value,
Object valueSource)
This method validates the given
value. |
createBundle, isDynamic, validateprivate static final String CODE
getCode(),
Constant Field Valuesprivate final AbstractValidator<? super V>[] validators
@SafeVarargs public ComposedValidator(AbstractValidator<? super V>... validators)
validators - are the validators to compose.public boolean isMandatory()
isMandatory in class AbstractValidator<V>true if this is a validator for mandatory fields (that will not accept null or
empty values), false otherwise.protected String getCode()
code of this
ValueValidator. classname of the actual
ValueValidator implementation. This strategy is chosen for simplicity when implementing a new validator. To
ensure stable codes override this method and return a string constant. This shall at least be done when the name of
the class is changed.getCode in class AbstractValidator<V>code.public 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.public int getValidatorCount()
validators.getValidator(int),
Collection.size()public ValueValidator<? super V> getValidator(int index)
ValueValidator at the given index.index - is the index of the ValueValidator to get.ValueValidator.List.get(int)Copyright © 2001–2015 mmm-Team. All rights reserved.