E - the generic type of the elements contained in the Collection.V - 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 AbstractCollectionValidatorBuilder<E,V extends Collection<E>,PARENT,SELF extends AbstractCollectionValidatorBuilder<E,V,PARENT,SELF>> extends ComplexValidatorBuilder<V,PARENT,SELF>
| Modifier and Type | Field and Description |
|---|---|
private ObjectValidatorBuilder<E,? extends SELF,?> |
subBuilder |
| Constructor and Description |
|---|
AbstractCollectionValidatorBuilder(PARENT parent)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
AbstractValidator<? super V> |
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<E,? extends SELF,?>> |
with(BiFunction<ObjectValidatorBuilderFactory<SELF>,E,SUB> factory)
Creates a new
builder for the validators to invoke for
each element contained in the Collection.Use ObjectValidatorBuilder.and() to return to this builder after the sub-builder is complete.A typical usage looks like this: |
getSubFactoryadd, and, getValidators, mandatory, range, selfprivate ObjectValidatorBuilder<E,? extends SELF extends AbstractCollectionValidatorBuilder<E,V,PARENT,SELF>,?> subBuilder
public SELF size(Range<Integer> range)
range - the Range to limit the size of the Collection.ValidatorCollectionSizepublic 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<E,? extends SELF,?>> SUB with(BiFunction<ObjectValidatorBuilderFactory<SELF>,E,SUB> factory)
builder for the validators to invoke for
each element contained in the Collection.ObjectValidatorBuilder.and() to return to this builder after the sub-builder is complete.[...].with((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 V> build()
BuilderBuilder is reused, any additional changes to the
Builder shall NOT have any effect on instances previously returned by this method.build in interface Builder<AbstractValidator<? super V extends Collection<E>>>build in class ObjectValidatorBuilder<V extends Collection<E>,PARENT,SELF extends AbstractCollectionValidatorBuilder<E,V,PARENT,SELF>>AbstractValidatorCopyright © 2001–2016 mmm-Team. All rights reserved.