javax.slee.profile.query
Class LongestPrefixMatch

java.lang.Object
  extended by javax.slee.profile.query.QueryExpression
      extended by javax.slee.profile.query.SimpleQueryExpression
          extended by 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 nameValue of prefix attribute
A1
B12
C123
D1234
E124

The table below indicates which profiles would match using the longest prefix rule given various attribute values to test:
Test valueMatching profile name
1653333A
1256999B
1238764C
1234567D
1247123E
2987654none

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 javax.slee.profile.query.SimpleQueryExpression
getAttributeName, getAttributeValue, getCollator, toString
 
Methods inherited from class javax.slee.profile.query.QueryExpression
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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.
Method Detail

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.