javax.slee.profile.query
Class LongestPrefixMatch
java.lang.Object
javax.slee.profile.query.QueryExpression
javax.slee.profile.query.SimpleQueryExpression
javax.slee.profile.query.LongestPrefixMatch
- All Implemented Interfaces:
- java.io.Serializable
public final class LongestPrefixMatch
- extends SimpleQueryExpression
The 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 |
The table below indicates which profiles would match using the longest prefix rule
given various attribute values to test:
| Test value | Matching profile name |
| 1653333 | A |
| 1256999 | B |
| 1238764 | C |
| 1234567 | D |
| 1247123 | E |
| 2987654 | none |
- See Also:
- Serialized Form
|
Constructor Summary |
LongestPrefixMatch(java.lang.String attrName,
java.lang.String attrValue)
Create a LongestPrefixMatch query expression. |
LongestPrefixMatch(java.lang.String attrName,
java.lang.String attrValue,
QueryCollator collator)
Create a LongestPrefixMatch query expression. |
|
Method Summary |
protected java.lang.String |
getRelation()
Get the symbol or other name for this expression relation to be used in the
toString output. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LongestPrefixMatch
public LongestPrefixMatch(java.lang.String attrName,
java.lang.String attrValue)
- Create a
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).
- Parameters:
attrName - the name of the profile attribute to compare.attrValue - the value of the attribute to compare with.
- Throws:
java.lang.NullPointerException - if either argument is null.
LongestPrefixMatch
public LongestPrefixMatch(java.lang.String attrName,
java.lang.String attrValue,
QueryCollator collator)
- Create a
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.
- Parameters:
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.
- Throws:
java.lang.NullPointerException - if either attrName or
attrValue is null.
getRelation
protected java.lang.String getRelation()
- Description copied from class:
SimpleQueryExpression
- Get the symbol or other name for this expression relation to be used in the
toString output.
- Specified by:
getRelation in class SimpleQueryExpression
- Returns:
- the symbol or other name for this expression relation.
Copyright © 2009. All Rights Reserved.