public final class RangeMatch extends QueryExpression
RangeMatch class represents a dynamic query expression that checks
whether the value of a profile attribute lies within a specified range. A profile
matches the expression if the profile attribute value is greater than or equal to
the lower bound value and less than or equal to the upper bound value.
This query expression can only be used with profile attributes whose class
implements the Comparable interface.
| Constructor and Description |
|---|
RangeMatch(String attrName,
Object fromValue,
Object toValue)
Create a
RangeMatch query expression. |
RangeMatch(String attrName,
String fromValue,
String toValue,
QueryCollator collator)
Create a
RangeMatch query expression. |
| Modifier and Type | Method and Description |
|---|---|
String |
getAttributeName()
Get the name of the profile attribute used by this query expression.
|
QueryCollator |
getCollator()
Get the query collator used by this query expression.
|
Object |
getFromValue()
Get the lower-bound value the profile attribute will be compared to.
|
Object |
getToValue()
Get the upper-bound value the profile attribute will be compared to.
|
protected void |
toString(StringBuffer buf)
Get a string representation for this query expression.
|
toStringpublic RangeMatch(String attrName, Object fromValue, Object toValue)
RangeMatch query expression. A profile will match the
expression criteria if the value of the attrName attribute is
greater than or equal to fromValue and less than or equal to
toValue, as determined by Comparable.compareTo(Object).attrName - the name of the profile attribute to compare.fromValue - the lower bound of the range.toValue - the upper bound of the range.NullPointerException - if any argument is null.IllegalArgumentException - if the class of fromValue or
toValue does not implement the java.lang.Comparable
interface.public RangeMatch(String attrName, String fromValue, String toValue, QueryCollator collator)
RangeMatch query expression. A profile will match the
expression criteria if the value of the attrName attribute is
greater than or equal to fromValue and less than or equal to
toValue, as determined by Collator.compare(String, String),
where the collator is obtained from the specified QueryCollator.attrName - the name of the profile attribute to compare.fromValue - the lower bound of the range.toValue - the upper bound of the range.collator - the collator to use for the comparison. May be null.NullPointerException - if attrName, fromValue,
or toValue is null.IllegalArgumentException - if the class of fromValue or
toValue does not implement the java.lang.Comparable
interface.public String getAttributeName()
public Object getFromValue()
public Object getToValue()
public QueryCollator getCollator()
null if one has not been
specified for this query expression.protected void toString(StringBuffer buf)
QueryExpressiontoString in class QueryExpressionbuf - a string buffer the string representation should be appended to.