Package org.ldaptive.filter
Class AbstractFilterFunction
java.lang.Object
org.ldaptive.filter.AbstractFilterFunction
- All Implemented Interfaces:
FilterFunction
- Direct Known Subclasses:
DefaultFilterFunction,RegexFilterFunction
Base implementation to parse an LDAP search filter string.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate intfindMatchingParenPosition(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.Parses the supplied string representation of a filter.protected abstract FilterparseFilterComp(String filter) Inspects the supplied filter string and creates the type of filter it represents.private FilterSetreadFilterSet(FilterSet set, String filter, int start, int end, int depth) Reads the supplied filter using the supplied indices and adds them to the supplied filter set.private FilterreadNextComponent(String filter, int depth) Reads the next component contained in the supplied filter.
-
Field Details
-
MAX_FILTER_DEPTH
private static final int MAX_FILTER_DEPTHMaximum filter depth.- See Also:
-
-
Constructor Details
-
AbstractFilterFunction
public AbstractFilterFunction()
-
-
Method Details
-
parse
Description copied from interface:FilterFunctionParses the supplied string representation of a filter.- Specified by:
parsein interfaceFilterFunction- Parameters:
filter- to parse- Returns:
- parsed filter
- Throws:
FilterParseException- if the supplied filter is invalid
-
readNextComponent
Reads the next component contained in the supplied filter.- Parameters:
filter- to parsedepth- counter to track invocation depth- 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, int depth) 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 filterdepth- counter to track invocation depth- Returns:
- the supplied filter set with components added from filter
- Throws:
FilterParseException- if filter doesn't start with '(' and containing a matching ')'
-
findMatchingParenPosition
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
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
-