E
- the generic type of the elements contained
in the collection.public class ValidatorCollectionElements<E> extends AbstractValidator<Collection<E>> implements ComposedValueValidator<Collection<E>>
Modifier and Type | Field and Description |
---|---|
private AbstractValidator<? super E>[] |
validators
The child validators.
|
PROPERTY_MANDATORY, PROPERTY_MAXIMUM, PROPERTY_MINIMUM
Constructor and Description |
---|
ValidatorCollectionElements(AbstractValidator<? super E>... validators)
The constructor.
|
ValidatorCollectionElements(List<AbstractValidator<? super E>> validators)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
AbstractValidator<?> |
getValidator(int index)
Gets the
ValueValidator at the given index . |
int |
getValidatorCount() |
int |
hashCode() |
ValidationFailure |
validate(Collection<E> value,
Object valueSource)
This method validates the given
value . |
append, contains, createBundle, getCode, getProperty, isDynamic, isMandatory, validate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
validate
private final AbstractValidator<? super E>[] validators
@SafeVarargs public ValidatorCollectionElements(AbstractValidator<? super E>... validators)
validators
- the AbstractValidator
s used to validate
each element.public ValidatorCollectionElements(List<AbstractValidator<? super E>> validators)
validators
- the AbstractValidator
s used to validate
each element.public AbstractValidator<?> getValidator(int index)
ComposedValueValidator
ValueValidator
at the given index
.getValidator
in interface ComposedValueValidator<Collection<E>>
index
- is the index of the ValueValidator
to get.ValueValidator
.List.get(int)
public int getValidatorCount()
getValidatorCount
in interface ComposedValueValidator<Collection<E>>
validators
.ComposedValueValidator.getValidator(int)
,
Collection.size()
public ValidationFailure validate(Collection<E> value, Object valueSource)
ValueValidator
value
.validate
in interface ValueValidator<Collection<E>>
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 hashCode()
hashCode
in class AbstractValidator<Collection<E>>
public boolean equals(Object obj)
equals
in class AbstractValidator<Collection<E>>
Copyright © 2001–2016 mmm-Team. All rights reserved.