public class RangeConstraint extends ConstraintObject
RangeConstraint implements
the constraint defined by a range min and a range max.
Integer, long, big decimal, big integer and date entities
can be constrained by a range constraint.
The standard way to create a RangeConstraint instance is to use the
method ConstraintObject.createConstraintFromString(String)
with a string representation of a range constraint.
ConstraintObject.MetaChar| Modifier and Type | Field and Description |
|---|---|
static int |
TYPE_EXCLUSIVE
the exclusive type for range constraint.
|
static int |
TYPE_INCLUSIVE
the inclusive type for range constraint.
|
compatibilityTable, NO_SUBTYPE, separator, separatorChar, STRING_TYPE_BIG_INTEGER, STRING_TYPE_BOOLEAN, STRING_TYPE_DATE, STRING_TYPE_DECIMAL, STRING_TYPE_ENUMERATED_LIST, STRING_TYPE_FORMAT, STRING_TYPE_INTEGER, STRING_TYPE_LONG, STRING_TYPE_RANGE, STRING_TYPE_STRING, TYPE_BIG_INTEGER, TYPE_BOOLEAN, TYPE_DATE, TYPE_DECIMAL, TYPE_ENUMERATED_LIST, TYPE_FORMAT, TYPE_INTEGER, TYPE_LONG, TYPE_RANGE, TYPE_STRING| Constructor and Description |
|---|
RangeConstraint()
Builds a range constraint.
|
RangeConstraint(java.lang.Object rangeMin,
int rangeMinType,
java.lang.Object rangeMax,
int rangeMaxType)
Build a range constraint with minimum and maximum values plus their type (
TYPE_INCLUSIVE, TYPE_EXCLUSIVE) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getInitializationString()
Returns the initialization string.
|
java.lang.Object |
getRangeMax()
Returns the range max of range constraint.
|
int |
getRangeMaxType()
Returns the range max type of range constraint.
|
java.lang.Object |
getRangeMin()
Returns the range min of range constraint.
|
int |
getRangeMinType()
Returns the range min type of range constraint.
|
boolean |
isBigIntegerConstraint()
Returns big integer status of the range constraint.
|
boolean |
isBooleanConstraint()
Returns boolean status of the range constraint.
|
boolean |
isDateConstraint()
Returns date status of the range constraint.
|
boolean |
isDecimalConstraint()
Returns decimal status of the range constraint.
|
boolean |
isIntegerConstraint()
Returns integer status of the range constraint.
|
boolean |
isLongConstraint()
Returns long status of the range constraint.
|
boolean |
isStringConstraint()
Returns string status of the range constraint.
|
boolean |
isValidValue(java.lang.Object value)
Tests if the value checks the range constraint.
|
void |
setInitializationString(java.lang.String initializationString)
Sets the initialization string.
|
void |
setRangeMax(java.lang.Object rangeMax)
Sets the range max of range constraint.
|
void |
setRangeMaxType(int rangeMaxType)
Sets the range max type of range constraint.
|
void |
setRangeMin(java.lang.Object rangeMin)
Sets the range min of range constraint.
|
void |
setRangeMinType(int rangeMinType)
Sets the range min type of range constraint.
|
java.lang.String |
toString()
Returns
string representationthat represents the range constraint. |
createConstraintFromString, equals, escapeMetaChar, getAllowedConstraintTypes, getConstraintSubType, getConstraintType, hashCode, isEscapedChar, parseConstraintSubType, unescapeMetaChar, unescapeSeparatorCharpublic static final int TYPE_INCLUSIVE
public static final int TYPE_EXCLUSIVE
public RangeConstraint()
public RangeConstraint(java.lang.Object rangeMin,
int rangeMinType,
java.lang.Object rangeMax,
int rangeMaxType)
TYPE_INCLUSIVE, TYPE_EXCLUSIVE)rangeMin - the minimum range valuerangeMinType - the type of minimum range value (TYPE_INCLUSIVE, TYPE_EXCLUSIVE)rangeMax - the maximum range valuerangeMaxType - the type of maximum range value (TYPE_INCLUSIVE, TYPE_EXCLUSIVE)public java.lang.String getInitializationString()
getInitializationString in class ConstraintObjectpublic void setInitializationString(java.lang.String initializationString)
initializationString - the initialization string.public java.lang.Object getRangeMin()
public void setRangeMin(java.lang.Object rangeMin)
rangeMin - the range Min.public int getRangeMinType()
TYPE_INCLUSIVE,
TYPE_EXCLUSIVEpublic void setRangeMinType(int rangeMinType)
A range min specifies a range type . The allowed types are :
rangeMinType - the range min type.public java.lang.Object getRangeMax()
public void setRangeMax(java.lang.Object rangeMax)
rangeMax - the range Max.public int getRangeMaxType()
TYPE_INCLUSIVE,
TYPE_EXCLUSIVEpublic void setRangeMaxType(int rangeMaxType)
A range max specifies a range type . The allowed types are :
rangeMaxType - the range max type.public boolean isValidValue(java.lang.Object value)
isValidValue in class ConstraintObjectvalue - the value to checktrue if the value checks the range constraint.
false otherwise.public java.lang.String toString()
string representationthat represents the range constraint.toString in class ConstraintObjectpublic boolean isIntegerConstraint()
isIntegerConstraint in class ConstraintObjectpublic boolean isLongConstraint()
isLongConstraint in class ConstraintObjectpublic boolean isBigIntegerConstraint()
isBigIntegerConstraint in class ConstraintObjectpublic boolean isDecimalConstraint()
isDecimalConstraint in class ConstraintObjectpublic boolean isDateConstraint()
isDateConstraint in class ConstraintObjectpublic boolean isStringConstraint()
isStringConstraint in class ConstraintObjectpublic boolean isBooleanConstraint()
isBooleanConstraint in class ConstraintObject