Class FilterEncoder
- java.lang.Object
-
- org.apache.directory.api.ldap.model.filter.FilterEncoder
-
public final class FilterEncoder extends Object
An encoder for LDAP filters.- Author:
- Apache Directory Project
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
encodeFilterValue(String value)
Handles encoding of special characters in LDAP search filter assertion values using the <valueencoding> rule as described in RFC 4515.static String
format(String filterTemplate, String... values)
Formats a filter and handles encoding of special characters in the value arguments using the <valueencoding> rule as described in RFC 4515.
-
-
-
Method Detail
-
format
public static String format(String filterTemplate, String... values)
Formats a filter and handles encoding of special characters in the value arguments using the <valueencoding> rule as described in RFC 4515.Example of filter template format:
(&(cn={0})(uid={1}))
- Parameters:
filterTemplate
- the filter with placeholdersvalues
- the values to encode and substitute- Returns:
- the formatted filter with escaped values
- Throws:
IllegalArgumentException
- if the number of values does not match the number of placeholders in the template
-
encodeFilterValue
public static String encodeFilterValue(String value)
Handles encoding of special characters in LDAP search filter assertion values using the <valueencoding> rule as described in RFC 4515.- Parameters:
value
- Right hand side of "attrId=value" assertion occurring in an LDAP search filter.- Returns:
- Escaped version of
value
-
-