Package org.ldaptive.filter
Class RegexFilterFunction
- java.lang.Object
-
- org.ldaptive.filter.AbstractFilterFunction
-
- org.ldaptive.filter.RegexFilterFunction
-
- All Implemented Interfaces:
FilterFunction
public class RegexFilterFunction extends AbstractFilterFunction
Parses an LDAP search filter string using regular expressions.
-
-
Field Summary
Fields Modifier and Type Field Description private static PatternAPPROXIMATE_FILTER_PATTERNRegex pattern to match an approximate filter.private static StringASSERTION_VALUERegular expression that matches an assertion value.private static StringATTRIBUTE_DESCRegular expression that matches an attribute description.private static PatternEQUALITY_FILTER_PATTERNRegex pattern to match an equality filter.private static PatternESCAPE_CHARS_PATTERNRegular expression that matches characters that should have been escaped.private static PatternEXTENSIBLE_FILTER_PATTERNRegex pattern to match an extensible filter.private static PatternGREATER_OR_EQUAL_FILTER_PATTERNRegex pattern to match a greater or equal filter.private static PatternLESS_OR_EQUAL_FILTER_PATTERNRegex pattern to match a less or equal filter.private static PatternPRESENCE_FILTER_PATTERNRegex pattern to match a presence filter.private static PatternSUBSTRING_FILTER_PATTERNRegex pattern to match a substring filter.
-
Constructor Summary
Constructors Constructor Description RegexFilterFunction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static ApproximateFilterparseApproximateFilter(String component)Creates a new approximate filter by parsing the supplied filter string.(package private) static EqualityFilterparseEqualityFilter(String component)Creates a new equality filter by parsing the supplied filter string.(package private) static ExtensibleFilterparseExtensibleFilter(String component)Creates a new extensible filter by parsing the supplied filter string.protected FilterparseFilterComp(String filter)Inspects the supplied filter string and creates the type of filter it represents.(package private) static GreaterOrEqualFilterparseGreaterOrEqualFilter(String component)Creates a new greater or equal filter by parsing the supplied filter string.(package private) static LessOrEqualFilterparseLessOrEqualFilter(String component)Creates a new less or equal filter by parsing the supplied filter string.(package private) static PresenceFilterparsePresenceFilter(String component)Creates a new presence filter by parsing the supplied filter string.(package private) static SubstringFilterparseSubstringFilter(String component)Creates a new substring filter by parsing the supplied filter string.private static voidthrowOnEscapeChars(String... values)Throws an exception if the supplied value matchesESCAPE_CHARS_PATTERN.-
Methods inherited from class org.ldaptive.filter.AbstractFilterFunction
parse
-
-
-
-
Field Detail
-
ATTRIBUTE_DESC
private static final String ATTRIBUTE_DESC
Regular expression that matches an attribute description.- See Also:
- Constant Field Values
-
ASSERTION_VALUE
private static final String ASSERTION_VALUE
Regular expression that matches an assertion value.- See Also:
- Constant Field Values
-
ESCAPE_CHARS_PATTERN
private static final Pattern ESCAPE_CHARS_PATTERN
Regular expression that matches characters that should have been escaped.
-
PRESENCE_FILTER_PATTERN
private static final Pattern PRESENCE_FILTER_PATTERN
Regex pattern to match a presence filter.
-
EQUALITY_FILTER_PATTERN
private static final Pattern EQUALITY_FILTER_PATTERN
Regex pattern to match an equality filter.
-
SUBSTRING_FILTER_PATTERN
private static final Pattern SUBSTRING_FILTER_PATTERN
Regex pattern to match a substring filter.
-
EXTENSIBLE_FILTER_PATTERN
private static final Pattern EXTENSIBLE_FILTER_PATTERN
Regex pattern to match an extensible filter.
-
GREATER_OR_EQUAL_FILTER_PATTERN
private static final Pattern GREATER_OR_EQUAL_FILTER_PATTERN
Regex pattern to match a greater or equal filter.
-
LESS_OR_EQUAL_FILTER_PATTERN
private static final Pattern LESS_OR_EQUAL_FILTER_PATTERN
Regex pattern to match a less or equal filter.
-
APPROXIMATE_FILTER_PATTERN
private static final Pattern APPROXIMATE_FILTER_PATTERN
Regex pattern to match an approximate filter.
-
-
Method Detail
-
parseFilterComp
protected Filter parseFilterComp(String filter) throws FilterParseException
Description copied from class:AbstractFilterFunctionInspects the supplied filter string and creates the type of filter it represents.- Specified by:
parseFilterCompin classAbstractFilterFunction- Parameters:
filter- to inspect- Returns:
- search filter
- Throws:
FilterParseException- if filter is invalid
-
parsePresenceFilter
static PresenceFilter parsePresenceFilter(String component)
Creates a new presence filter by parsing the supplied filter string.- Parameters:
component- to parse- Returns:
- presence filter or null if component doesn't match this filter type
-
parseEqualityFilter
static EqualityFilter parseEqualityFilter(String component) throws FilterParseException
Creates a new equality filter by parsing the supplied filter string.- Parameters:
component- to parse- Returns:
- equality filter or null if component doesn't match this filter type
- Throws:
FilterParseException- if the filter is invalid
-
parseSubstringFilter
static SubstringFilter parseSubstringFilter(String component) throws FilterParseException
Creates a new substring filter by parsing the supplied filter string.- Parameters:
component- to parse- Returns:
- substring filter or null if component doesn't match this filter type
- Throws:
FilterParseException- if the filter contains values that should have been escaped
-
parseExtensibleFilter
static ExtensibleFilter parseExtensibleFilter(String component) throws FilterParseException
Creates a new extensible filter by parsing the supplied filter string.- Parameters:
component- to parse- Returns:
- extensible filter or null if component doesn't match this filter type
- Throws:
FilterParseException- if the component cannot be parsed
-
parseGreaterOrEqualFilter
static GreaterOrEqualFilter parseGreaterOrEqualFilter(String component) throws FilterParseException
Creates a new greater or equal filter by parsing the supplied filter string.- Parameters:
component- to parse- Returns:
- greater or equal filter or null if component doesn't match this filter type
- Throws:
FilterParseException- if the component cannot be parsed
-
parseLessOrEqualFilter
static LessOrEqualFilter parseLessOrEqualFilter(String component) throws FilterParseException
Creates a new less or equal filter by parsing the supplied filter string.- Parameters:
component- to parse- Returns:
- less or equal filter or null if component doesn't match this filter type
- Throws:
FilterParseException- if the component cannot be parsed
-
parseApproximateFilter
static ApproximateFilter parseApproximateFilter(String component) throws FilterParseException
Creates a new approximate filter by parsing the supplied filter string.- Parameters:
component- to parse- Returns:
- approximate filter or null if component doesn't match this filter type
- Throws:
FilterParseException- if the component cannot be parsed
-
throwOnEscapeChars
private static void throwOnEscapeChars(String... values) throws FilterParseException
Throws an exception if the supplied value matchesESCAPE_CHARS_PATTERN.- Parameters:
values- to check- Throws:
FilterParseException- if a value contains characters that should be escaped
-
-