public final class LongestPrefixMatch extends SimpleQueryExpression
LongestPrefixMatch class represents a dynamic query expression that
determines if a profile attribute value is the longest prefix match against a
specified value.
This query expression can only be used with profile attributes of type
java.lang.String.
As an example of how this query expression can be used, consider a profile
specification that contains a String attribute named "prefix".
A number of profiles exist in a profile table as shown below:
| Profile name | Value of prefix attribute |
|---|---|
| A | 1 |
| B | 12 |
| C | 123 |
| D | 1234 |
| E | 124 |
| Test value | Matching profile name |
|---|---|
| 1653333 | A |
| 1256999 | B |
| 1238764 | C |
| 1234567 | D |
| 1247123 | E |
| 2987654 | none |
| Constructor and Description |
|---|
LongestPrefixMatch(String attrName,
String attrValue)
Create a
LongestPrefixMatch query expression. |
LongestPrefixMatch(String attrName,
String attrValue,
QueryCollator collator)
Create a
LongestPrefixMatch query expression. |
| Modifier and Type | Method and Description |
|---|---|
protected String |
getRelation()
Get the symbol or other name for this expression relation to be used in the
toString output. |
getAttributeName, getAttributeValue, getCollator, toStringtoStringpublic LongestPrefixMatch(String attrName, String attrValue)
LongestPrefixMatch query expression. A profile will match
the expression criteria if the value of the attrName attribute
is the longest prefix match for the value specified by attrValue,
as determined by String.startsWith(String).attrName - the name of the profile attribute to compare.attrValue - the value of the attribute to compare with.NullPointerException - if either argument is null.public LongestPrefixMatch(String attrName, String attrValue, QueryCollator collator)
LongestPrefixMatch query expression. A profile will match
the expression criteria if the value of the attrName attribute
is the longest prefix match for the value specified by attrValue,
as determined by Collator.equals(String, String), where the
collator is obtained from the specified QueryCollator.attrName - the name of the profile attribute to compare.attrValue - the value of the attribute to compare with.collator - the collator to use for the comparison. May be null.NullPointerException - if either attrName or
attrValue is null.protected String getRelation()
SimpleQueryExpressiontoString output.getRelation in class SimpleQueryExpression