Spring LDAP Framework

org.springframework.ldap.filter
Class CompareFilter

java.lang.Object
  extended by org.springframework.ldap.filter.AbstractFilter
      extended by org.springframework.ldap.filter.CompareFilter
All Implemented Interfaces:
Filter
Direct Known Subclasses:
EqualsFilter, GreaterThanOrEqualsFilter, LessThanOrEqualsFilter

public abstract class CompareFilter
extends AbstractFilter

Abstract superclass for filters that compare values.

Author:
Mattias Hellborg Arthursson

Constructor Summary
CompareFilter(String attribute, int value)
          Convenience constructor for int values.
CompareFilter(String attribute, String value)
           
 
Method Summary
 StringBuffer encode(StringBuffer buff)
          Encodes the filter to a StringBuffer.
protected  String encodeValue(String value)
          Override to perform special encoding in subclass.
 boolean equals(Object o)
          Compares key and value before encoding.
protected abstract  String getCompareString()
          Implement this method in subclass to return a String representing the operator.
 int hashCode()
          Calculate the hash code for the attribute and the value.
 
Methods inherited from class org.springframework.ldap.filter.AbstractFilter
encode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompareFilter

public CompareFilter(String attribute,
                     String value)

CompareFilter

public CompareFilter(String attribute,
                     int value)
Convenience constructor for int values.

Parameters:
attribute - Name of attribute in filter.
value - The value of the attribute in the filter.
Method Detail

encodeValue

protected String encodeValue(String value)
Override to perform special encoding in subclass.

Parameters:
value - the value to encode.
Returns:
properly escaped value.

encode

public StringBuffer encode(StringBuffer buff)
Description copied from interface: Filter
Encodes the filter to a StringBuffer.

Specified by:
encode in interface Filter
Specified by:
encode in class AbstractFilter
Parameters:
buff - The StringBuffer to encode the filter to
Returns:
The same StringBuffer as was given

equals

public boolean equals(Object o)
Compares key and value before encoding.

Specified by:
equals in interface Filter
Overrides:
equals in class Object
Returns:
true if the objects are equal.
See Also:
Filter.equals(java.lang.Object)

hashCode

public int hashCode()
Calculate the hash code for the attribute and the value.

Specified by:
hashCode in interface Filter
Overrides:
hashCode in class Object
Returns:
the hash code according to the contract in Object.hashCode()
See Also:
Filter.hashCode()

getCompareString

protected abstract String getCompareString()
Implement this method in subclass to return a String representing the operator. The EqualsFilter.getCompareString() would for example return an equals sign, "=".

Returns:
the String to use as operator in the comparison for the specific subclass.

Spring LDAP Framework

Copyright © 2005-2010 The Spring LDAP Framework. All Rights Reserved.