Class AbstractMapValidatorBuilder<K,V,M extends Map<K,V>,PARENT,SELF extends AbstractMapValidatorBuilder<K,V,M,PARENT,SELF>>
- java.lang.Object
-
- io.github.mmm.validation.main.ObjectValidatorBuilder<V,PARENT,SELF>
-
- io.github.mmm.validation.main.ContainerValidatorBuilder<M,PARENT,SELF>
-
- io.github.mmm.validation.collection.AbstractMapValidatorBuilder<K,V,M,PARENT,SELF>
-
- Type Parameters:
K
- the generic type of thekeys
.V
- the generic type of thevalues
.M
- 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 M>>
,ValidatorRegistry<M,SELF>
- Direct Known Subclasses:
ValidatorBuilderMap
public abstract class AbstractMapValidatorBuilder<K,V,M extends Map<K,V>,PARENT,SELF extends AbstractMapValidatorBuilder<K,V,M,PARENT,SELF>> extends ContainerValidatorBuilder<M,PARENT,SELF>
- Since:
- 8.5.0
- Author:
- hohwille
-
-
Constructor Summary
Constructors Constructor Description AbstractMapValidatorBuilder(PARENT parent)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Validator<? super M>
build()
Creates a new instance of the object to build.SELF
max(int max)
SELF
size(int min, int max)
SELF
size(Range<Number> range)
<SUB extends ObjectValidatorBuilder<K,? extends SELF,?>>
SUBwithKeys(BiFunction<ObjectValidatorBuilderFactory<SELF>,K,SUB> factory)
Creates a newbuilder
for thevalidators
to invoke for eachkey
in theMap
.
UseObjectValidatorBuilder.and()
to return to this builder after the sub-builder is complete.
A typical usage looks like this:<SUB extends ObjectValidatorBuilder<V,? extends SELF,?>>
SUBwithValues(BiFunction<ObjectValidatorBuilderFactory<SELF>,V,SUB> factory)
Creates a newbuilder
for thevalidators
to invoke for eachvalues
in theMap
.
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, range, self
-
-
-
-
Method Detail
-
size
public SELF size(Range<Number> range)
- Parameters:
range
- theRange
to limit thesize
of theMap
.- 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)
-
withKeys
public <SUB extends ObjectValidatorBuilder<K,? extends SELF,?>> SUB withKeys(BiFunction<ObjectValidatorBuilderFactory<SELF>,K,SUB> factory)
Creates a newbuilder
for thevalidators
to invoke for eachkey
in theMap
.
UseObjectValidatorBuilder.and()
to return to this builder after the sub-builder is complete.
A typical usage looks like this:[...].withKeys((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.
-
withValues
public <SUB extends ObjectValidatorBuilder<V,? extends SELF,?>> SUB withValues(BiFunction<ObjectValidatorBuilderFactory<SELF>,V,SUB> factory)
Creates a newbuilder
for thevalidators
to invoke for eachvalues
in theMap
.
UseObjectValidatorBuilder.and()
to return to this builder after the sub-builder is complete.
A typical usage looks like this:[...].withValues((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.
-
-