public abstract class Constraint extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Condition |
condition |
protected Object |
operand |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
conformsToConstraint(Object value)
Returns true if
value conforms to this constraint, false
if not. |
static String |
constraintsToString(Constraint[] constraints)
A convenient method to neatly list the Constraints.
|
static Constraint |
createConstraint(Class type,
Condition condition,
Object operand)
Construct a constraint with the given options
|
Condition |
getCondition() |
static Condition[] |
getConstraints(Class type)
Returns an array of conditions which are allowed to be used to
constrain the given type.
|
static String[] |
getNiceNames(Class type)
Returns an array of user-friendly names for conditions which are
allowed to be used to constrain the given type.
|
Object |
getOperand()
Returns the operand or value of this constraint (eg.
|
String |
toString() |
public static String constraintsToString(Constraint[] constraints)
constraints - an array of Constraintspublic static Constraint createConstraint(Class type, Condition condition, Object operand)
type - class of the value which this constraint acts on.condition - eg. "is greater than"operand - eg. 20public static Condition[] getConstraints(Class type)
type - java Class of value to be constrainedpublic static String[] getNiceNames(Class type)
getConstraints(Class).type - java Class of value to be constrainedpublic abstract boolean conformsToConstraint(Object value)
value conforms to this constraint, false
if not.value - to test for conformityvalue conforms to this constraintpublic Condition getCondition()
public Object getOperand()