Package org.forgerock.opendj.ldap
Class Matcher
- java.lang.Object
-
- org.forgerock.opendj.ldap.Matcher
-
public final class Matcher extends Object
A compiled searchFilterwhich may be used formatchingagainst entries.Compilationmay produce an optimized matcher having a different structure to the original filter. In particular, filter components may be simplified, removed, or re-ordered. Equivalent matchers compare equal usingequals(Object)and produce the samehashCode().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMatcher.MatcherTypeThe types of compiled matcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)This method returnstruewhen two filters are equivalent.AssertiongetAssertion()Returns the assertion for this comparison filterMatcher.AttributeDescriptiongetAttributeDescription()Returns the attribute description for this comparison filterMatcher, which may benullif the filter is an extensible match filter specifying an extensible matching rule.FiltergetFilter()Returns the rawFilterassociated with this comparison or undefined filterMatcher.Matcher.MatcherTypegetMatcherType()Returns the type of this filterMatcher.MatchergetNotSubMatcher()Returns the sub-matcher for this NOT filterMatcher.List<Matcher>getSubMatchers()Returns an unmodifiable list containing the sub-matchers for this AND or OR filterMatcher.inthashCode()This method returns the same hash-code for any two equivalent filters.ConditionResultmatches(Entry entry)Indicates whether this filterMatchermatches the providedEntry.StringtoString()
-
-
-
Method Detail
-
equals
public boolean equals(Object obj)
This method returnstruewhen two filters are equivalent. In particular, the attribute descriptions "cn" and "commonName" will be treated the same, as will AND/OR filters containing the same sub-filters regardless of their order.
-
hashCode
public int hashCode()
This method returns the same hash-code for any two equivalent filters. In particular, the attribute descriptions "cn" and "commonName" will be treated the same, as will AND/OR filters containing the same sub-filters regardless of their order.
-
getMatcherType
public Matcher.MatcherType getMatcherType()
Returns the type of this filterMatcher.- Returns:
- The type of this filter
Matcher.
-
getFilter
public Filter getFilter()
Returns the rawFilterassociated with this comparison or undefined filterMatcher.- Returns:
- The raw
Filterassociated with this comparison or undefined filterMatcher. - Throws:
UnsupportedOperationException- If this filterMatcheris not an equality, greater than, less than, approximate, presence, substrings, extensible or undefined filter.
-
getSubMatchers
public List<Matcher> getSubMatchers()
Returns an unmodifiable list containing the sub-matchers for this AND or OR filterMatcher.- Returns:
- An unmodifiable list containing the sub-matchers for this AND or OR filter
Matcher. - Throws:
UnsupportedOperationException- If this filterMatcheris not an AND or OR filter.
-
getNotSubMatcher
public Matcher getNotSubMatcher()
Returns the sub-matcher for this NOT filterMatcher.- Returns:
- The sub-matcher for this NOT filter
Matcher. - Throws:
UnsupportedOperationException- If this filterMatcheris not a NOT filter.
-
getAttributeDescription
public AttributeDescription getAttributeDescription()
Returns the attribute description for this comparison filterMatcher, which may benullif the filter is an extensible match filter specifying an extensible matching rule.- Returns:
- The attribute description for this comparison filter
Matcher, which may benullif the filter is an extensible match filter. - Throws:
UnsupportedOperationException- If this filterMatcheris not an equality, greater than, less than, approximate, presence, substrings, or extensible match filter.
-
getAssertion
public Assertion getAssertion()
Returns the assertion for this comparison filterMatcher.- Returns:
- The assertion for this comparison filter
Matcher. - Throws:
UnsupportedOperationException- If this filterMatcheris not an equality, greater than, less than, approximate, or extensible match filter.
-
matches
public ConditionResult matches(Entry entry)
Indicates whether this filterMatchermatches the providedEntry.- Parameters:
entry- The entry to be matched.- Returns:
- The result of matching the provided
Entryagainst this filterMatcher.
-
-