public class RegexConstraint extends Object implements Constraint
Constructor and Description |
---|
RegexConstraint(String regex,
String errorMessage)
Creates a new regex 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
|
static Constraint |
validEmail()
Generates a valid email constraint by using a regular expression
|
static Constraint |
validEmail(String errorMessage)
Generates a valid email constraint by using a regular expression
|
static Constraint |
validURL()
Generates a valid URL constraint by using a regular expression
|
static Constraint |
validURL(String errorMessage)
Generates a valid URL constraint by using a regular expression
|
public static Constraint validEmail(String errorMessage)
errorMessage
- error message for the constraintpublic static Constraint validEmail()
public static Constraint validURL(String errorMessage)
errorMessage
- error message for the constraintpublic static Constraint validURL()
public boolean isValid(Object value)
isValid
in interface Constraint
value
- the value for the objectpublic String getDefaultFailMessage()
getDefaultFailMessage
in interface Constraint