Package org.ldaptive.filter
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 Summary
Constructors Constructor Description AbstractFilterFunction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private int
findMatchingParenPosition(String filter, int start)
Returns the index in the supplied filter of the closing paren that matches the opening paren at the start of the filter.Filter
parse(String filter)
Parses the supplied string representation of a filter.protected abstract Filter
parseFilterComp(String filter)
Inspects the supplied filter string and creates the type of filter it represents.private FilterSet
readFilterSet(FilterSet set, String filter, int start, int end)
Reads the supplied filter using the supplied indices and adds them to the supplied filter set.private Filter
readNextComponent(String filter)
Reads the next component contained in the supplied filter.
-
-
-
Method Detail
-
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 interfaceFilterFunction
- 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 updatefilter
- to parsestart
- position in filterend
- 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 searchstart
- 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
-
-