S - the type of this builder's source object (eg. ConfigValueBuilder or ConstraintsBuilderT - the type of Constraint this builder should outputB - the type of this, for chainingpublic abstract class ConstraintsBuilder<S,T,B extends ConstraintsBuilder<S,T,B>> extends AbstractConstraintsBuilder<S,T,T,B>
Constraints.
This is the abstract base class for all builders of this type. Builders implementing this class include ConstraintsBuilder.Scalar and ConstraintsBuilder.Aggregate.
| Modifier and Type | Class and Description |
|---|---|
static class |
ConstraintsBuilder.Aggregate<S,T,C>
An implementation of
ConstraintsBuilder for aggregate constraints. |
static class |
ConstraintsBuilder.Scalar<S,T>
An implementation of
ConstraintsBuilder for scalar constraints. |
source, sourceConstraints, type| Modifier and Type | Method and Description |
|---|---|
static <S,A,T> ConstraintsBuilder.Aggregate<S,A,T> |
aggregate(S source,
java.util.List<Constraint<? super A>> constraints,
java.lang.Class<A> aggregateType,
java.lang.Class<T> componentType)
Creates a new aggregate constraint builder
|
CompositeConstraintBuilder<B,T> |
composite(CompositeType type)
Creates a new
CompositeConstraintBuilder from this ConstraintsBuilder. |
S |
finish()
Finishes building constraints.
|
static <S,T> ConstraintsBuilder.Scalar<S,T> |
scalar(S source,
java.util.List<Constraint<? super T>> constraints,
java.lang.Class<T> type)
Creates a new scalar constraint builder
|
public static <S,T> ConstraintsBuilder.Scalar<S,T> scalar(S source, java.util.List<Constraint<? super T>> constraints, java.lang.Class<T> type)
S - the type of sourceT - the type type representssource - the ConfigValueBuilder this ConstraintsBuilder originates fromconstraints - the list of constraints this builder will add totype - the class of the type of values checked by constraints built by this builderConstraintsBuilder.Scalarpublic static <S,A,T> ConstraintsBuilder.Aggregate<S,A,T> aggregate(S source, java.util.List<Constraint<? super A>> constraints, java.lang.Class<A> aggregateType, java.lang.Class<T> componentType)
S - the type of sourceA - the type of aggregateTypeT - the type of componentTypesource - the ConfigValueBuilder 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 aggregateTypeConstraintsBuilder.Aggregatepublic CompositeConstraintBuilder<B,T> composite(CompositeType type)
CompositeConstraintBuilder 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.
type - the type of composite to createpublic S finish()
As a result of this call, the built constraints will be added to the source ConfigValue builder.