Package org.springframework.ldap.filter
Class HardcodedFilter
java.lang.Object
org.springframework.ldap.filter.AbstractFilter
org.springframework.ldap.filter.HardcodedFilter
- All Implemented Interfaces:
Filter
Allows hard coded parts to be included in a search filter. Particularly useful
if some filters are specified in configuration files and these should be
combined with other ones.
Filter filter = new HardcodedFilter("(&(objectClass=user)(!(objectClass=computer)))");
System.out.println(filter.toString());
would result in:
(&(objectClass=user)(!(objectClass=computer)))
Note 1: If the definition is in XML you will need to properly encode any special characters so that they are valid in an XML file, e.g. "&" needs to be encoded as "&", e.g.
<bean class="MyClass"> <property name="filter" value="(&(objectClass=user)(!(objectClass=computer)))" /> </bean>
Note 2: There will be no validation to ensure that the supplied filter is valid. Using this implementation to build filters from user input is strongly discouraged.
-
Constructor Summary
ConstructorsConstructorDescriptionHardcodedFilter(String filter) The hardcoded string to be used for this filter. -
Method Summary
Modifier and TypeMethodDescriptionencode(StringBuffer buff) Encodes the filter to a StringBuffer.booleanAll filters must implement equals.inthashCode()All filters must implement hashCode.Methods inherited from class org.springframework.ldap.filter.AbstractFilter
encode, toString
-
Constructor Details
-
HardcodedFilter
The hardcoded string to be used for this filter.- Parameters:
filter- the hardcoded filter string.
-
-
Method Details
-
encode
Description copied from interface:FilterEncodes the filter to a StringBuffer.- Parameters:
buff- The StringBuffer to encode the filter to- Returns:
- The same StringBuffer as was given
-
equals
Description copied from interface:FilterAll filters must implement equals. -
hashCode
public int hashCode()Description copied from interface:FilterAll filters must implement hashCode.- Specified by:
hashCodein interfaceFilter- Overrides:
hashCodein classObject- Returns:
- the hash code according to the contract in
Object.hashCode()
-