public class ListEachConstraint<T> extends Object implements ParameterConstraint<List<T>>
Modifier and Type | Field and Description |
---|---|
private List<ParameterConstraint<? super T>> |
constraints
Constraints
|
Constructor and Description |
---|
ListEachConstraint()
Constructor.
|
ListEachConstraint(ParameterConstraint<? super T> constraint)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addConstraint(ParameterConstraint<? super T> constraint)
Add a constraint to this operator.
|
String |
getDescription(String parameterName)
Returns a description of this constraint.
|
void |
test(List<T> t)
Checks if the value
t of the parameter to be tested fulfills the parameter constraint. |
private List<ParameterConstraint<? super T>> constraints
public ListEachConstraint()
public ListEachConstraint(ParameterConstraint<? super T> constraint)
constraint
- Constraint to apply to all elementspublic void addConstraint(ParameterConstraint<? super T> constraint)
constraint
- Constraintpublic void test(List<T> t) throws ParameterException
ParameterConstraint
t
of the parameter to be tested fulfills the parameter constraint.
If not, a parameter exception is thrown.test
in interface ParameterConstraint<List<T>>
t
- Value to be checked whether or not it fulfills the underlying
parameter constraint.ParameterException
- if the parameter to be tested does not
fulfill the parameter constraintpublic String getDescription(String parameterName)
ParameterConstraint
getDescription
in interface ParameterConstraint<List<T>>
parameterName
- the name of the parameter this constraint is used for