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 ObjectValidatorBuilder<V,PARENT,SELF extends ObjectValidatorBuilder<V,PARENT,SELF>> extends Object implements Builder<AbstractValidator<? super V>>
AbstractValidator
using the builder pattern.Modifier and Type | Field and Description |
---|---|
private PARENT |
parent |
private List<AbstractValidator<? super V>> |
validators |
Constructor and Description |
---|
ObjectValidatorBuilder(PARENT parent)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
SELF |
add(AbstractValidator<? super V> validator) |
PARENT |
and() |
AbstractValidator<? super V> |
build()
Creates a new instance of the object to build.
|
protected <T> List<AbstractValidator<? super T>> |
getValidators(ObjectValidatorBuilder<T,?,?> builder) |
SELF |
mandatory()
Value is
mandatory . |
abstract SELF |
range(String min,
String max)
This method allows to define a range in a generic way.
|
protected SELF |
self() |
private final PARENT parent
private final List<AbstractValidator<? super V>> validators
protected <T> List<AbstractValidator<? super T>> getValidators(ObjectValidatorBuilder<T,?,?> builder)
T
- the generic type of the value to validate
.builder
- the ObjectValidatorBuilder
.List
of validators.protected SELF self()
public SELF add(AbstractValidator<? super V> validator)
validator
- the AbstractValidator
to add to this builder.public SELF mandatory()
mandatory
.public abstract SELF range(String min, String max)
CompareableValidatorBuilder.range(net.sf.mmm.util.value.api.Range)
instead.min
- the minimum value allowed or null
for no lower bound.max
- the maximum value allowed or null
for no upper bound.public AbstractValidator<? super V> build()
Builder
Builder
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>>
AbstractValidator
Copyright © 2001–2016 mmm-Team. All rights reserved.