A - the type of Constraint this builder should outputS - the type of this builder's source object (eg. ConfigLeafBuilder or ConstraintsBuilder)T - the type of intermediary objects this builder's constraints should process. May be identical to A.public abstract class AbstractConstraintsBuilder<S,A,T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected S |
source |
protected java.util.List<Constraint<? super A>> |
sourceConstraints |
protected java.lang.Class<T> |
type |
| Modifier and Type | Method and Description |
|---|---|
AbstractConstraintsBuilder<S,A,T> |
atLeast(T min)
Implies that any value must be bigger than or equal to
min |
AbstractConstraintsBuilder<S,A,T> |
atMost(T max)
Implies that any value must be smaller than or equal to
max |
AbstractConstraintsBuilder<S,A,T> |
maxLength(int max) |
AbstractConstraintsBuilder<S,A,T> |
minLength(int min) |
AbstractConstraintsBuilder<S,A,T> |
range(T min,
T max)
Convenience method to specify a range of valid values a number can take.
|
AbstractConstraintsBuilder<S,A,T> |
regex(java.lang.String regexPattern) |
protected final S source
protected final java.util.List<Constraint<? super A>> sourceConstraints
@Nullable protected final java.lang.Class<T> type
public AbstractConstraintsBuilder<S,A,T> atLeast(T min) throws RuntimeFiberException
minmin - The minimum valuejava.lang.IllegalArgumentException - if min is not a NumberRuntimeFiberExceptionpublic AbstractConstraintsBuilder<S,A,T> atMost(T max)
maxmax - The maximum valuejava.lang.UnsupportedOperationException - if this builder is not for a numerical valuejava.lang.IllegalArgumentException - if max is not a Numberpublic AbstractConstraintsBuilder<S,A,T> range(T min, T max)
This method behaves as if: this.atLeast(min).atMost(max)
min - The minimum valuemax - The maximum valuejava.lang.UnsupportedOperationException - if this builder is not for a numerical valuejava.lang.IllegalArgumentException - if min or max is not a Numberpublic AbstractConstraintsBuilder<S,A,T> minLength(int min)
public AbstractConstraintsBuilder<S,A,T> maxLength(int max)
public AbstractConstraintsBuilder<S,A,T> regex(@RegEx java.lang.String regexPattern)