Class AbstractCollectionValidatorBuilder<E,V extends Collection<E>,PARENT,SELF extends AbstractCollectionValidatorBuilder<E,V,PARENT,SELF>>
java.lang.Object
io.github.mmm.validation.main.ObjectValidatorBuilder<V,PARENT,SELF>
io.github.mmm.validation.main.ContainerValidatorBuilder<V,PARENT,SELF>
io.github.mmm.validation.collection.AbstractCollectionValidatorBuilder<E,V,PARENT,SELF>
- Type Parameters:
E- the generic type of theelements containedin theCollection.V- the generic type of the value tovalidate.PARENT- the generic type of theparent builder.SELF- the generic type of this builder itself (this).
- All Implemented Interfaces:
io.github.mmm.base.lang.Builder<Validator<? super V>>,ValidatorRegistry<V,SELF>
- Direct Known Subclasses:
ValidatorBuilderCollection,ValidatorBuilderList,ValidatorBuilderSet
public abstract class AbstractCollectionValidatorBuilder<E,V extends Collection<E>,PARENT,SELF extends AbstractCollectionValidatorBuilder<E,V,PARENT,SELF>>
extends ContainerValidatorBuilder<V,PARENT,SELF>
Validator builder of for Collection.- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()max(int max) This method allows to define a range in a generic way.size(int min, int max) <SUB extends ObjectValidatorBuilder<E,? extends SELF, ?>>
SUBwith(BiFunction<ObjectValidatorBuilderFactory<SELF>, E, SUB> factory) Creates a newbuilderfor thevalidatorsto invoke for eachelement containedin theCollection.
UseObjectValidatorBuilder.and()to return to this builder after the sub-builder is complete.
A typical usage looks like this:Methods inherited from class io.github.mmm.validation.main.ContainerValidatorBuilder
getSubFactoryMethods inherited from class io.github.mmm.validation.main.ObjectValidatorBuilder
add, add, and, getValidators, mandatory, max, min, self
-
Constructor Details
-
AbstractCollectionValidatorBuilder
The constructor.- Parameters:
parent- theparentbuilder.
-
-
Method Details
-
size
- Parameters:
range- theRangeto limit thesizeof theCollection.- Returns:
- this build instance for fluent API calls.
- See Also:
-
size
-
max
- Parameters:
max- the maximumsizeallowed.- Returns:
- this build instance for fluent API calls.
- See Also:
-
range
Description copied from class:ObjectValidatorBuilderThis method allows to define a range in a generic way. If you have a properly typed builder please use more specific methods such asComparableValidatorBuilder.range(io.github.mmm.base.range.Range)instead.- Specified by:
rangein classObjectValidatorBuilder<V extends Collection<E>,PARENT, SELF extends AbstractCollectionValidatorBuilder<E, V, PARENT, SELF>> - Parameters:
min- the minimum value allowed ornullfor no lower bound.max- the maximum value allowed ornullfor no upper bound.- Returns:
- this build instance for fluent API calls.
-
with
public <SUB extends ObjectValidatorBuilder<E,? extends SELF, SUB with?>> (BiFunction<ObjectValidatorBuilderFactory<SELF>, E, SUB> factory) Creates a newbuilderfor thevalidatorsto invoke for eachelement containedin theCollection.
UseObjectValidatorBuilder.and()to return to this builder after the sub-builder is complete.
A typical usage looks like this:[...].with((f, v) -> f.create(v)).[...].and().[...].build()
- Type Parameters:
SUB- the generic type of the returned sub-builder.- Parameters:
factory- lambda function used to create the returned sub-builder by calling the accordingcreatemethod on the suppliedObjectValidatorBuilderFactorywith the given dummy element.- Returns:
- the new sub-builder.
-
build
- Specified by:
buildin interfaceio.github.mmm.base.lang.Builder<E>- Overrides:
buildin classObjectValidatorBuilder<V extends Collection<E>,PARENT, SELF extends AbstractCollectionValidatorBuilder<E, V, PARENT, SELF>> - Returns:
- the
AbstractValidator
-