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 containedin 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 builderof 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.SELFmax(int max)SELFrange(String min, String max)This method allows to define a range in a generic way.SELFsize(int min, int max)SELFsize(Range<Number> range)<SUB extends ObjectValidatorBuilder<E,? extends SELF,?>>
SUBwith(BiFunction<ObjectValidatorBuilderFactory<SELF>,E,SUB> factory)Creates a newbuilderfor thevalidatorsto invoke for eachelement containedin 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- theRangeto limit thesizeof theCollection.- Returns:
- this build instance for fluent API calls.
- See Also:
ValidatorCollectionSize
-
size
public SELF size(int min, int max)
- Parameters:
min- the minimumsizeallowed.max- the maximumsizeallowed.- Returns:
- this build instance for fluent API calls.
- See Also:
size(Range)
-
max
public SELF max(int max)
- Parameters:
max- the maximumsizeallowed.- Returns:
- this build instance for fluent API calls.
- See Also:
size(Range)
-
range
public SELF range(String min, String max)
Description copied from class:ObjectValidatorBuilderThis 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:
rangein classObjectValidatorBuilder<V extends Collection<E>,PARENT,SELF extends AbstractCollectionValidatorBuilder<E,V,PARENT,SELF>>- Parameters:
min- the minimum value allowed ornullfor no lower bound.max- the maximum value allowed ornullfor 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 newbuilderfor thevalidatorsto invoke for eachelement containedin 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 accordingcreatemethod on the suppliedObjectValidatorBuilderFactorywith the given dummy element.- Returns:
- the new sub-builder.
-
build
public Validator<? super V> build()
Description copied from interface:BuilderCreates a new instance of the object to build. If theBuilderis reused, any additional changes to theBuildershall NOT have any effect on instances previously returned by this method.- Specified by:
buildin interfaceBuilder<E>- Overrides:
buildin classObjectValidatorBuilder<V extends Collection<E>,PARENT,SELF extends AbstractCollectionValidatorBuilder<E,V,PARENT,SELF>>- Returns:
- the
AbstractValidator
-
-