public static class ConstraintParser.Constraint
extends java.lang.Object
<token>(<constraint>)
token is normalised to uppercase and must be provided by the environment.
constraint is an integer range specified in one of the following formats:
()
(1234)
1234
(1234+) (1234-) (1234>)
(<1234)
(<=1234)
1234<
)(>1234)
(>=1234)
1234
>)(1234-1300)
(1234+10)
All whitespace is ignored in constraint declarations. The following declarations are equivalent:
token(123-456) token ( 123 - 456 )
Multiple constraints should be separated by semicolon (;)
and are conjoined by an implied logical AND operator. That
is: all constraints must pass for the constraint to be considered valid.
| Modifier and Type | Field and Description |
|---|---|
static ConstraintParser.Constraint |
NONE |
| Modifier and Type | Method and Description |
|---|---|
void |
check(ITokenProvider environment)
Checks the current token against the environment and throws a
ConstraintViolationException if the constraint is invalid |
int |
getMax() |
int |
getMin() |
java.lang.String |
getRangeHumanReadable()
Gets a human-readable description of the range expressed by this
constraint
|
java.lang.String |
getToken() |
java.lang.String |
toString() |
public static final ConstraintParser.Constraint NONE
public java.lang.String getToken()
public int getMin()
public int getMax()
public void check(ITokenProvider environment) throws ConstraintViolationException
ConstraintViolationException if the constraint is invalidenvironment - environment to fetch constraintsConstraintViolationException - if constraint is not validpublic java.lang.String getRangeHumanReadable()
public java.lang.String toString()
toString in class java.lang.Object