K
- the generic type of the keys
.V
- the generic type of the values
.M
- the generic type of the value to validate
.PARENT
- the generic type of the parent builder
.SELF
- the generic type of this builder itself (this).public abstract class AbstractMapValidatorBuilder<K,V,M extends Map<K,V>,PARENT,SELF extends AbstractMapValidatorBuilder<K,V,M,PARENT,SELF>> extends ComplexValidatorBuilder<M,PARENT,SELF>
Modifier and Type | Field and Description |
---|---|
private ObjectValidatorBuilder<K,? extends SELF,?> |
keySubBuilder |
private ObjectValidatorBuilder<V,? extends SELF,?> |
valueSubBuilder |
Constructor and Description |
---|
AbstractMapValidatorBuilder(PARENT parent)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
AbstractValidator<? 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<Integer> range) |
<SUB extends ObjectValidatorBuilder<K,? extends SELF,?>> |
withKeys(BiFunction<ObjectValidatorBuilderFactory<SELF>,K,SUB> factory)
Creates a new
builder for the validators to invoke for
each key in the Map .Use ObjectValidatorBuilder.and() to return to this builder after the sub-builder is complete.A typical usage looks like this: |
<SUB extends ObjectValidatorBuilder<V,? extends SELF,?>> |
withValues(BiFunction<ObjectValidatorBuilderFactory<SELF>,V,SUB> factory)
Creates a new
builder for the validators to invoke for
each values in the Map .Use ObjectValidatorBuilder.and() to return to this builder after the sub-builder is complete.A typical usage looks like this: |
getSubFactory
add, and, getValidators, mandatory, range, self
private ObjectValidatorBuilder<K,? extends SELF extends AbstractMapValidatorBuilder<K,V,M,PARENT,SELF>,?> keySubBuilder
private ObjectValidatorBuilder<V,? extends SELF extends AbstractMapValidatorBuilder<K,V,M,PARENT,SELF>,?> valueSubBuilder
public SELF size(Range<Integer> range)
range
- the Range
to limit the size
of the Map
.ValidatorCollectionSize
public SELF size(int min, int max)
min
- the minimum size
allowed.max
- the maximum size
allowed.size(Range)
public SELF max(int max)
max
- the maximum size
allowed.size(Range)
public <SUB extends ObjectValidatorBuilder<K,? extends SELF,?>> SUB withKeys(BiFunction<ObjectValidatorBuilderFactory<SELF>,K,SUB> factory)
builder
for the validators
to invoke for
each key
in the Map
.ObjectValidatorBuilder.and()
to return to this builder after the sub-builder is complete.[...].withKeys((f, v) -> f.create(v)).[...].and().[...].build()
SUB
- the generic type of the returned sub-builder.factory
- lambda function used to create the returned sub-builder by calling the according create
method on the supplied ObjectValidatorBuilderFactory
with the given dummy element.public <SUB extends ObjectValidatorBuilder<V,? extends SELF,?>> SUB withValues(BiFunction<ObjectValidatorBuilderFactory<SELF>,V,SUB> factory)
builder
for the validators
to invoke for
each values
in the Map
.ObjectValidatorBuilder.and()
to return to this builder after the sub-builder is complete.[...].withValues((f, v) -> f.create(v)).[...].and().[...].build()
SUB
- the generic type of the returned sub-builder.factory
- lambda function used to create the returned sub-builder by calling the according create
method on the supplied ObjectValidatorBuilderFactory
with the given dummy element.public AbstractValidator<? super M> build()
Builder
Copyright © 2001–2016 mmm-Team. All rights reserved.