Package org.ldaptive.filter
Class DefaultFilterFunction
java.lang.Object
org.ldaptive.filter.AbstractFilterFunction
org.ldaptive.filter.DefaultFilterFunction
- All Implemented Interfaces:
FilterFunction
Parses an LDAP search filter string.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DefaultFilterFunction
(String validChars) Creates a new default filter function. -
Method Summary
Modifier and TypeMethodDescriptionprivate ExtensibleFilter
parseExtensible
(String attribute, CharBuffer cb) Parses the supplied buffer and creates an extensible filter.protected Filter
parseFilterComp
(String filter) Inspects the supplied filter string and creates the type of filter it represents.private Filter
parseSubstringOrEquality
(String attribute, CharBuffer cb) Parses the supplied buffer and returns either a substring or equality filter.private CharBuffer
Returns a new buffer containing an attribute description.private Map
<String, List<CharBuffer>> Reads the supplied buffer and builds a map of the substring data it contains.private CharBuffer
sliceAtMatch
(CharBuffer cb, char match) Returns a new char buffer whose position is 0 and whose limit is before the match character.Methods inherited from class org.ldaptive.filter.AbstractFilterFunction
parse
-
Field Details
-
DEFAULT_ATTRIBUTE_DESCRIPTION_CHARS
Lower and upper case ASCII alphabetical, digits, semi-colon, dot, dash.- See Also:
-
attributeDescriptionChars
Allowed attribute description characters.
-
-
Constructor Details
-
DefaultFilterFunction
public DefaultFilterFunction()Default constructor. -
DefaultFilterFunction
Creates a new default filter function.- Parameters:
validChars
- characters that are valid for an attribute description
-
-
Method Details
-
parseFilterComp
Description copied from class:AbstractFilterFunction
Inspects the supplied filter string and creates the type of filter it represents.- Specified by:
parseFilterComp
in classAbstractFilterFunction
- Parameters:
filter
- to inspect- Returns:
- search filter
- Throws:
FilterParseException
- if filter is invalid
-
readAttribute
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 descriptioncb
- containing the assertion- Returns:
- either EqualityFilter or SubstringFilter
- Throws:
FilterParseException
- if neither substring or equality syntax can be parsed
-
readSubstrings
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
- 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 nullcb
- to parse- Returns:
- extensible filter
- Throws:
FilterParseException
- if the buffer does not contain an extensible expression
-
sliceAtMatch
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 searchmatch
- to search for- Returns:
- new char buffer or null if there is no match
-