Package io.github.mmm.validation.main
Class ObjectValidatorBuilder<V,PARENT,SELF extends ObjectValidatorBuilder<V,PARENT,SELF>>
java.lang.Object
io.github.mmm.validation.main.ObjectValidatorBuilder<V,PARENT,SELF>
- Type Parameters:
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:
io.github.mmm.base.lang.Builder<Validator<? super V>>,ValidatorRegistry<V,SELF>
- Direct Known Subclasses:
CharSequenceValidatorBuilder,ComparableValidatorBuilder,ContainerValidatorBuilder,ValidatorBuilderBoolean,ValidatorBuilderObject,ValidatorBuilderPattern,ValidatorBuilderRange
public abstract class ObjectValidatorBuilder<V,PARENT,SELF extends ObjectValidatorBuilder<V,PARENT,SELF>>
extends Object
implements io.github.mmm.base.lang.Builder<Validator<? super V>>, ValidatorRegistry<V,SELF>
This is the base class to create instances of
AbstractValidator using the builder pattern.- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(AbstractValidator<? super V> validator) and()build()getValidators(ObjectValidatorBuilder<T, ?, ?> builder) Value ismandatory.This method allows to define a maximum.This method allows to define a minimum.abstract SELFThis method allows to define a range in a generic way.protected SELFself()
-
Constructor Details
-
ObjectValidatorBuilder
The constructor.- Parameters:
parent- theparentbuilder.
-
-
Method Details
-
add
- Specified by:
addin interfaceValidatorRegistry<V,PARENT> - Parameters:
validator- theAbstractValidatorto add to this builder.- Returns:
- this build instance for fluent API calls.
-
getValidators
- Type Parameters:
T- the generic type of the value tovalidate.- Parameters:
builder- theObjectValidatorBuilder.- Returns:
- the
Listof validators.
-
and
- Returns:
- the parent
Builderornullif <PARENT> is void.
-
self
- Returns:
- this build instance for fluent API calls.
-
add
- Parameters:
validator- theAbstractValidatorto add to this builder.- Returns:
- this build instance for fluent API calls.
-
mandatory
Value ismandatory.- Returns:
- this build instance for fluent API calls.
-
min
This method allows to define a minimum. Values exceeding this minimum will be invalid. Avoid usingmin(String)andmax(String)and userange(String, String)in such case.- Parameters:
min- the minimum value allowed.- Returns:
- this build instance for fluent API calls.
-
max
This method allows to define a maximum. Values exceeding this maximum will be invalid.- Parameters:
max- the maximum value allowed.- Returns:
- this build instance for fluent API calls.
-
range
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.- 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.
-
build
- Specified by:
buildin interfaceio.github.mmm.base.lang.Builder<V>- Returns:
- the
AbstractValidator
-