S - the type of this builder's source objectT - the type of aggregate type this builder will checkpublic final class CompositeConstraintsBuilder<S,T> extends AbstractConstraintsBuilder<S,T,T>
Composite constraints are constraints that have 0 or more child constraints.
Whether or not a value satisfies a composite constraint is specified by the composite's CompositeType.
| Modifier and Type | Class and Description |
|---|---|
static class |
CompositeConstraintsBuilder.AbstractCompositeConstraint<T> |
source, sourceConstraints, type| Constructor and Description |
|---|
CompositeConstraintsBuilder(S source,
CompositeType compositeType,
java.util.List<Constraint<? super T>> sourceConstraints,
java.lang.Class<T> type) |
| Modifier and Type | Method and Description |
|---|---|
CompositeConstraintsBuilder<S,T> |
atLeast(T min)
Implies that any value must be bigger than or equal to
min |
CompositeConstraintsBuilder<S,T> |
atMost(T max)
Implies that any value must be smaller than or equal to
max |
S |
finishComposite() |
CompositeConstraintsBuilder<S,T> |
maxLength(int max) |
CompositeConstraintsBuilder<S,T> |
minLength(int min) |
CompositeConstraintsBuilder<S,T> |
range(T min,
T max)
Convenience method to specify a range of valid values a number can take.
|
CompositeConstraintsBuilder<S,T> |
regex(java.lang.String regexPattern) |
getTypepublic CompositeConstraintsBuilder(S source, CompositeType compositeType, java.util.List<Constraint<? super T>> sourceConstraints, java.lang.Class<T> type)
public CompositeConstraintsBuilder<S,T> atLeast(T min) throws RuntimeFiberException
AbstractConstraintsBuilderminatLeast in class AbstractConstraintsBuilder<S,T,T>min - The minimum valueRuntimeFiberExceptionpublic CompositeConstraintsBuilder<S,T> atMost(T max)
AbstractConstraintsBuildermaxatMost in class AbstractConstraintsBuilder<S,T,T>max - The maximum valuepublic CompositeConstraintsBuilder<S,T> range(T min, T max)
AbstractConstraintsBuilder This method behaves as if: this.atLeast(min).atMost(max)
range in class AbstractConstraintsBuilder<S,T,T>min - The minimum valuemax - The maximum valuepublic CompositeConstraintsBuilder<S,T> minLength(int min)
minLength in class AbstractConstraintsBuilder<S,T,T>public CompositeConstraintsBuilder<S,T> maxLength(int max)
maxLength in class AbstractConstraintsBuilder<S,T,T>public CompositeConstraintsBuilder<S,T> regex(java.lang.String regexPattern)
regex in class AbstractConstraintsBuilder<S,T,T>public S finishComposite()