Class AbstractFilterFunction

java.lang.Object
org.ldaptive.filter.AbstractFilterFunction
All Implemented Interfaces:
FilterFunction
Direct Known Subclasses:
DefaultFilterFunction, RegexFilterFunction

public abstract class AbstractFilterFunction extends Object implements FilterFunction
Base implementation to parse an LDAP search filter string.
  • Constructor Details

    • AbstractFilterFunction

      public AbstractFilterFunction()
  • Method Details

    • parse

      public Filter parse(String filter) throws FilterParseException
      Description copied from interface: FilterFunction
      Parses the supplied string representation of a filter.
      Specified by:
      parse in interface FilterFunction
      Parameters:
      filter - to parse
      Returns:
      parsed filter
      Throws:
      FilterParseException - if the supplied filter is invalid
    • readNextComponent

      private Filter readNextComponent(String filter) throws FilterParseException
      Reads the next component contained in the supplied filter.
      Parameters:
      filter - to parse
      Returns:
      search filter
      Throws:
      FilterParseException - if filter does not start with '(' and end with ')'
    • readFilterSet

      private FilterSet readFilterSet(FilterSet set, String filter, int start, int end) throws FilterParseException
      Reads the supplied filter using the supplied indices and adds them to the supplied filter set.
      Parameters:
      set - to update
      filter - to parse
      start - position in filter
      end - position in filter
      Returns:
      the supplied filter set with components added from filter
      Throws:
      FilterParseException - if filter doesn't start with '(' and containing a matching ')'
    • findMatchingParenPosition

      private int findMatchingParenPosition(String filter, int start) throws FilterParseException
      Returns the index in the supplied filter of the closing paren that matches the opening paren at the start of the filter.
      Parameters:
      filter - to search
      start - position of the opening paren
      Returns:
      index of the matching paren
      Throws:
      FilterParseException - if filter is null, empty or does not begin with '('
    • parseFilterComp

      protected abstract Filter parseFilterComp(String filter) throws FilterParseException
      Inspects the supplied filter string and creates the type of filter it represents.
      Parameters:
      filter - to inspect
      Returns:
      search filter
      Throws:
      FilterParseException - if filter is invalid