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 contained
in 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 newbuilder
for thevalidators
to invoke for eachelement contained
in 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
getSubFactory
Methods inherited from class io.github.mmm.validation.main.ObjectValidatorBuilder
add, add, and, getValidators, mandatory, max, min, self
-
Constructor Details
-
AbstractCollectionValidatorBuilder
The constructor.- Parameters:
parent
- theparent
builder.
-
-
Method Details
-
size
- Parameters:
range
- theRange
to limit thesize
of theCollection
.- Returns:
- this build instance for fluent API calls.
- See Also:
-
size
-
max
- Parameters:
max
- the maximumsize
allowed.- Returns:
- this build instance for fluent API calls.
- See Also:
-
range
Description copied from class:ObjectValidatorBuilder
This 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:
range
in classObjectValidatorBuilder<V extends Collection<E>,
PARENT, SELF extends AbstractCollectionValidatorBuilder<E, V, PARENT, SELF>> - Parameters:
min
- the minimum value allowed ornull
for no lower bound.max
- the maximum value allowed ornull
for 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 newbuilder
for thevalidators
to invoke for eachelement contained
in 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 accordingcreate
method on the suppliedObjectValidatorBuilderFactory
with the given dummy element.- Returns:
- the new sub-builder.
-
build
- Specified by:
build
in interfaceio.github.mmm.base.lang.Builder<E>
- Overrides:
build
in classObjectValidatorBuilder<V extends Collection<E>,
PARENT, SELF extends AbstractCollectionValidatorBuilder<E, V, PARENT, SELF>> - Returns:
- the
AbstractValidator
-