A - the type of Constraint this builder should outputE - the type of the components in Tpublic class AggregateConstraintsBuilder<A,E> extends ConstraintsBuilder<A>
ConstraintsBuilder for aggregate constraints.
Aggregate types are those that hold multiple values, such as List or arrays.
The other, scalar types, such as Integer or String, are created using ConstraintsBuilder.
ConstraintsBuildersource, sourceConstraints, type| Constructor and Description |
|---|
AggregateConstraintsBuilder(ConfigAggregateBuilder<A,E> source,
java.util.List<Constraint<? super A>> constraints,
java.lang.Class<A> aggregateType,
java.lang.Class<E> componentType)
Creates a new aggregate constraint builder
|
| Modifier and Type | Method and Description |
|---|---|
AggregateConstraintsBuilder<A,E> |
atLeast(A min)
Implies that any value must be bigger than or equal to
min |
AggregateConstraintsBuilder<A,E> |
atMost(A max)
Implies that any value must be smaller than or equal to
max |
ComponentConstraintsBuilder<AggregateConstraintsBuilder<A,E>,A,E> |
component()
Creates a new
ComponentConstraintsBuilder. |
CompositeConstraintsBuilder<AggregateConstraintsBuilder<A,E>,A> |
composite(CompositeType type)
Creates a new
CompositeConstraintBuilder from this ConstraintsBuilder. |
ConfigAggregateBuilder<A,E> |
finishConstraints()
Finishes building constraints.
|
AggregateConstraintsBuilder<A,E> |
maxLength(int max) |
AggregateConstraintsBuilder<A,E> |
minLength(int min) |
AggregateConstraintsBuilder<A,E> |
range(A min,
A max)
Convenience method to specify a range of valid values a number can take.
|
AggregateConstraintsBuilder<A,E> |
regex(java.lang.String regexPattern) |
public AggregateConstraintsBuilder(ConfigAggregateBuilder<A,E> source, java.util.List<Constraint<? super A>> constraints, @Nonnull java.lang.Class<A> aggregateType, @Nullable java.lang.Class<E> componentType)
source - the ConfigLeafBuilder this ConstraintsBuilder originates fromconstraints - the list of constraints this builder will add toaggregateType - the type of collection or array source holdscomponentType - the type of all elements in aggregateTypepublic AggregateConstraintsBuilder<A,E> atLeast(A min) throws RuntimeFiberException
AbstractConstraintsBuilderminatLeast in class ConstraintsBuilder<A>min - The minimum valueRuntimeFiberExceptionpublic AggregateConstraintsBuilder<A,E> atMost(A max)
AbstractConstraintsBuildermaxatMost in class ConstraintsBuilder<A>max - The maximum valuepublic AggregateConstraintsBuilder<A,E> range(A min, A max)
AbstractConstraintsBuilder This method behaves as if: this.atLeast(min).atMost(max)
range in class ConstraintsBuilder<A>min - The minimum valuemax - The maximum valuepublic AggregateConstraintsBuilder<A,E> minLength(int min)
minLength in class ConstraintsBuilder<A>public AggregateConstraintsBuilder<A,E> maxLength(int max)
maxLength in class ConstraintsBuilder<A>public AggregateConstraintsBuilder<A,E> regex(java.lang.String regexPattern)
regex in class ConstraintsBuilder<A>public CompositeConstraintsBuilder<AggregateConstraintsBuilder<A,E>,A> composite(CompositeType type)
ConstraintsBuilderCompositeConstraintBuilder from this ConstraintsBuilder.
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.
composite in class ConstraintsBuilder<A>type - the type of composite to createpublic ComponentConstraintsBuilder<AggregateConstraintsBuilder<A,E>,A,E> component()
ComponentConstraintsBuilder.
Component constraints are constraints that test each value in an aggregate type. By default, all tested elements must satisfy the constraint in order for the entire constraint to be satisfied.
public ConfigAggregateBuilder<A,E> finishConstraints()
ConstraintsBuilder As a result of this call, the built constraints will be added to the source ConfigLeaf builder.
finishConstraints in class ConstraintsBuilder<A>