A - the type of Constraint this builder should outputS - the type of this builder's source object (eg. ConfigValueBuilder or ConstraintsBuilderT - the type of intermediary objects this builder's constraints should process. May be identical to A.B - the type of this, for chainingpublic abstract class AbstractConstraintsBuilder<S,A,T,B extends AbstractConstraintsBuilder<S,A,T,B>>
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 |
|---|---|
B |
atLeast(T min)
Implies that any value must be bigger than or equal to
min |
B |
atMost(T max)
Implies that any value must be smaller than or equal to
max |
B |
maxLength(int max) |
B |
minLength(int min) |
B |
range(T min,
T max)
Convenience method to specify a range of valid values a number can take.
|
B |
regex(java.lang.String regexPattern) |
protected B |
self() |
protected final S source
protected final java.util.List<Constraint<? super A>> sourceConstraints
protected final java.lang.Class<T> type
public B atLeast(T min) throws RuntimeFiberException
minmin - The minimum valuejava.lang.IllegalArgumentException - if min is not a NumberRuntimeFiberExceptionpublic B 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 B 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 B minLength(int min)
public B maxLength(int max)
public B regex(@RegEx java.lang.String regexPattern)
protected B self()