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:
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 forCollection
.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description AbstractCollectionValidatorBuilder(PARENT parent)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Validator<? super V>
build()
Creates a new instance of the object to build.SELF
max(int max)
SELF
range(String min, String max)
This method allows to define a range in a generic way.SELF
size(int min, int max)
SELF
size(Range<Number> range)
<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
-
-
-
-
Method Detail
-
size
public SELF size(Range<Number> range)
- Parameters:
range
- theRange
to limit thesize
of theCollection
.- Returns:
- this build instance for fluent API calls.
- See Also:
ValidatorCollectionSize
-
size
public SELF size(int min, int max)
- Parameters:
min
- the minimumsize
allowed.max
- the maximumsize
allowed.- Returns:
- this build instance for fluent API calls.
- See Also:
size(Range)
-
max
public SELF max(int max)
- Parameters:
max
- the maximumsize
allowed.- Returns:
- this build instance for fluent API calls.
- See Also:
size(Range)
-
range
public SELF range(String min, String max)
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
public Validator<? super V> build()
Description copied from interface:Builder
Creates a new instance of the object to build. If theBuilder
is reused, any additional changes to theBuilder
shall NOT have any effect on instances previously returned by this method.- Specified by:
build
in interfaceBuilder<E>
- Overrides:
build
in classObjectValidatorBuilder<V extends Collection<E>,PARENT,SELF extends AbstractCollectionValidatorBuilder<E,V,PARENT,SELF>>
- Returns:
- the
AbstractValidator
-
-