public class EqualStringConstraint extends Object implements ParameterConstraint<String>
StringParameter
) to be tested is equal to the specified constraint-strings.Modifier and Type | Field and Description |
---|---|
private String[] |
testStrings
Constraint-strings.
|
Constructor and Description |
---|
EqualStringConstraint(String[] testStrings)
Creates an Equal-To-String parameter constraint.
|
Modifier and Type | Method and Description |
---|---|
private String |
constraintStrings() |
String |
getDescription(String parameterName)
Returns a description of this constraint.
|
void |
test(String t)
Checks if the given string value of the string parameter is equal to one of
the constraint strings.
|
private String[] testStrings
public EqualStringConstraint(String[] testStrings)
testStrings
- constraint-strings.private String constraintStrings()
public void test(String t) throws ParameterException
test
in interface ParameterConstraint<String>
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<String>
parameterName
- the name of the parameter this constraint is used for