javax.slee.profile.query.LongestPrefixMatch Maven / Gradle / Ivy
package javax.slee.profile.query;
/**
* 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
*
*/
public final class LongestPrefixMatch extends SimpleQueryExpression {
/**
* 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 {@link String#startsWith(String)}.
* @param attrName the name of the profile attribute to compare.
* @param attrValue the value of the attribute to compare with.
* @throws NullPointerException if either argument is null
.
*/
public LongestPrefixMatch(String attrName, String attrValue) {
super(attrName, attrValue, null);
}
/**
* 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 {@link java.text.Collator#equals(String, String)}, where the
* collator is obtained from the specified QueryCollator
.
* @param attrName the name of the profile attribute to compare.
* @param attrValue the value of the attribute to compare with.
* @param collator the collator to use for the comparison. May be null
.
* @throws NullPointerException if either attrName
or
* attrValue
is null
.
*/
public LongestPrefixMatch(String attrName, String attrValue, QueryCollator collator) {
super(attrName, attrValue, collator);
}
// protected
// javadoc copied from parent
protected String getRelation() {
return "is-longest-prefix-of";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy