All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 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
*/ 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