public class NumericConstraint extends Object implements Constraint
| Constructor and Description |
|---|
NumericConstraint(boolean dec)
Creates a new numeric constraint
|
NumericConstraint(boolean dec,
double minimum,
double maximum,
String errorMessage)
Creates a new numeric 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 NumericConstraint(boolean dec,
double minimum,
double maximum,
String errorMessage)
dec - whether the number is decimal or integer, true for decimalminimum - the minimal value to a number or Double.NaN for no minimum valuemaximum - the maximum value to a number or Double.NaN for no minimum valueerrorMessage - the default error message if the constraint failspublic NumericConstraint(boolean dec)
dec - whether the number is decimal or integer, true for decimalpublic boolean isValid(Object value)
isValid in interface Constraintvalue - the value for the objectpublic String getDefaultFailMessage()
getDefaultFailMessage in interface Constraint