public class LengthConstraint extends Object implements Constraint
| Constructor and Description |
|---|
LengthConstraint(int length)
Creates a new length constraint
|
LengthConstraint(int length,
String errorMessage)
Creates a new length constraint
|
| Modifier and Type | Method and Description |
|---|---|
String |
getDefaultFailMessage()
Includes the error message for the constraint
|
boolean |
isValid(Object value)
Indicates if the given value is valid or not
|
public LengthConstraint(int length,
String errorMessage)
length - the length of the constrainterrorMessage - the default error message if the constraint failspublic LengthConstraint(int length)
length - the length of the constraintpublic boolean isValid(Object value)
isValid in interface Constraintvalue - the value for the objectpublic String getDefaultFailMessage()
getDefaultFailMessage in interface Constraint