Module io.github.mmm.validation
Package io.github.mmm.validation
Class AbstractComposedValidator<V,C>
- java.lang.Object
-
- io.github.mmm.validation.AbstractValidator<V>
-
- io.github.mmm.validation.AbstractComposedValidator<V,C>
-
- Type Parameters:
V
- type of the value tovalidate
.C
- type of the child value to validate using thechild validators
.
- All Implemented Interfaces:
Composable<Validator<?>>
,Validator<V>
,Iterable<Validator<?>>
- Direct Known Subclasses:
ComposedValidator
,ProjectionValidator
,ValidatorCollectionElements
,ValidatorMapKeys
,ValidatorMapValues
public abstract class AbstractComposedValidator<V,C> extends AbstractValidator<V>
Validator
that is composed out of a set of individualvalidators
given atconstruction
. It will always invoke allcontained validators
when avalidation
is performed.- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected Validator<? super C>[]
children
-
Fields inherited from interface io.github.mmm.validation.Validator
ID_MANDATORY
-
-
Constructor Summary
Constructors Constructor Description AbstractComposedValidator(Validator<? super C>... validators)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Validator<T>
append(Validator<?> validator)
<T> Validator<T>
append(Validator<?>... validators)
boolean
containsId(String id)
boolean
equals(Object obj)
Validator<? super C>
getChild(int index)
Gets the child-object at the givenindex
.int
getChildCount()
int
hashCode()
protected ValidationResult
validateChild(C value, String valueSource)
protected void
validateChild(C value, String valueSource, ValidationResultBuilder builder)
-
Methods inherited from class io.github.mmm.validation.AbstractValidator
getId, 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
iterator
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
AbstractComposedValidator
@SafeVarargs public AbstractComposedValidator(Validator<? super C>... validators)
The constructor.
-
-
Method Detail
-
validateChild
protected ValidationResult validateChild(C value, String valueSource)
- Parameters:
value
- is the value to validate.valueSource
- is thesource
.- Returns:
- the
ValidationResult
. - See Also:
Validator.validate(Object, Object)
-
validateChild
protected void validateChild(C value, String valueSource, ValidationResultBuilder builder)
- Parameters:
value
- is the value to validate.valueSource
- is thesource
.builder
- theValidationResultBuilder
.- See Also:
Validator.validate(Object, Object)
-
getChildCount
public int getChildCount()
- Returns:
- the number of contained
children
. - See Also:
Composable.getChild(int)
,Collection.size()
-
getChild
public Validator<? super C> getChild(int index)
Description copied from interface:Composable
Gets the child-object at the givenindex
.- Parameters:
index
- is the index of the child to get.- Returns:
- the requested child.
- See Also:
List.get(int)
-
containsId
public boolean containsId(String id)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractValidator<V>
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classAbstractValidator<V>
-
-