Class Matcher


  • public final class Matcher
    extends Object
    A compiled search Filter which may be used for matching against entries.

    Compilation may 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 using equals(Object) and produce the same hashCode().

    • Method Detail

      • equals

        public boolean equals​(Object obj)
        This method returns true when 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.
        Overrides:
        equals in class Object
      • 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.
        Overrides:
        hashCode in class Object
      • getMatcherType

        public Matcher.MatcherType getMatcherType()
        Returns the type of this filter Matcher.
        Returns:
        The type of this filter Matcher.
      • getFilter

        public Filter getFilter()
        Returns the raw Filter associated with this comparison or undefined filter Matcher.
        Returns:
        The raw Filter associated with this comparison or undefined filter Matcher.
        Throws:
        UnsupportedOperationException - If this filter Matcher is 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 filter Matcher.
        Returns:
        An unmodifiable list containing the sub-matchers for this AND or OR filter Matcher.
        Throws:
        UnsupportedOperationException - If this filter Matcher is not an AND or OR filter.
      • getNotSubMatcher

        public Matcher getNotSubMatcher()
        Returns the sub-matcher for this NOT filter Matcher.
        Returns:
        The sub-matcher for this NOT filter Matcher.
        Throws:
        UnsupportedOperationException - If this filter Matcher is not a NOT filter.
      • getAttributeDescription

        public AttributeDescription getAttributeDescription()
        Returns the attribute description for this comparison filter Matcher, which may be null if the filter is an extensible match filter specifying an extensible matching rule.
        Returns:
        The attribute description for this comparison filter Matcher, which may be null if the filter is an extensible match filter.
        Throws:
        UnsupportedOperationException - If this filter Matcher is not an equality, greater than, less than, approximate, presence, substrings, or extensible match filter.
      • getAssertion

        public Assertion getAssertion()
        Returns the assertion for this comparison filter Matcher.
        Returns:
        The assertion for this comparison filter Matcher.
        Throws:
        UnsupportedOperationException - If this filter Matcher is not an equality, greater than, less than, approximate, or extensible match filter.
      • matches

        public ConditionResult matches​(Entry entry)
        Indicates whether this filter Matcher matches the provided Entry.
        Parameters:
        entry - The entry to be matched.
        Returns:
        The result of matching the provided Entry against this filter Matcher.