Class DefaultFilterFunction

java.lang.Object
org.ldaptive.filter.AbstractFilterFunction
org.ldaptive.filter.DefaultFilterFunction
All Implemented Interfaces:
FilterFunction

public class DefaultFilterFunction extends AbstractFilterFunction
Parses an LDAP search filter string.
  • Field Details

    • DEFAULT_ATTRIBUTE_DESCRIPTION_CHARS

      protected static final String DEFAULT_ATTRIBUTE_DESCRIPTION_CHARS
      Lower and upper case ASCII alphabetical, digits, semi-colon, dot, dash.
      See Also:
    • attributeDescriptionChars

      private final String attributeDescriptionChars
      Allowed attribute description characters.
  • Constructor Details

    • DefaultFilterFunction

      public DefaultFilterFunction()
      Default constructor.
    • DefaultFilterFunction

      public DefaultFilterFunction(String validChars)
      Creates a new default filter function.
      Parameters:
      validChars - characters that are valid for an attribute description
  • Method Details

    • parseFilterComp

      protected Filter parseFilterComp(String filter) throws FilterParseException
      Description copied from class: AbstractFilterFunction
      Inspects the supplied filter string and creates the type of filter it represents.
      Specified by:
      parseFilterComp in class AbstractFilterFunction
      Parameters:
      filter - to inspect
      Returns:
      search filter
      Throws:
      FilterParseException - if filter is invalid
    • readAttribute

      private CharBuffer readAttribute(CharBuffer cb) throws FilterParseException
      Returns a new buffer containing an attribute description. The supplied buffer will have it's position set to the next position after the attribute.
      Parameters:
      cb - to read from
      Returns:
      new char buffer
      Throws:
      FilterParseException - if the char buffer is empty
    • parseSubstringOrEquality

      private Filter parseSubstringOrEquality(String attribute, CharBuffer cb) throws FilterParseException
      Parses the supplied buffer and returns either a substring or equality filter.
      Parameters:
      attribute - attribute description
      cb - containing the assertion
      Returns:
      either EqualityFilter or SubstringFilter
      Throws:
      FilterParseException - if neither substring or equality syntax can be parsed
    • readSubstrings

      private Map<String,List<CharBuffer>> readSubstrings(CharBuffer cb)
      Reads the supplied buffer and builds a map of the substring data it contains. The following keys are made available in the map:
      • INITIAL: singleton list containing the initial substring or null
      • ANY: list of any substring components or null
      • FINAL: singleton list containing the final substring or null
      • EQUALITY: singleton list containing the equality expression or null
      If the return map contains 'EQUALITY', all other entries will be null and the buffer should be considered an equality assertion.
      Parameters:
      cb - to read
      Returns:
      map of character buffers
    • parseExtensible

      private ExtensibleFilter parseExtensible(String attribute, CharBuffer cb) throws FilterParseException
      Parses the supplied buffer and creates an extensible filter.
      Parameters:
      attribute - attribute description or null
      cb - to parse
      Returns:
      extensible filter
      Throws:
      FilterParseException - if the buffer does not contain an extensible expression
    • sliceAtMatch

      private CharBuffer sliceAtMatch(CharBuffer cb, char match)
      Returns a new char buffer whose position is 0 and whose limit is before the match character. The supplied buffer has it's position incremented one position past the match character.
      Parameters:
      cb - to search
      match - to search for
      Returns:
      new char buffer or null if there is no match