org.springframework.ldap.support.filter
Class CompareFilter

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

public abstract class CompareFilter
extends AbstractFilter

Abstract superclass for filters to compare values.

Author:
Mattias Arthursson

Constructor Summary
CompareFilter(java.lang.String attribute, int value)
          Convenience constructor for int values.
CompareFilter(java.lang.String attribute, java.lang.String value)
           
 
Method Summary
 java.lang.StringBuffer encode(java.lang.StringBuffer buff)
          Prints the query with LDAP encoding to a stringbuffer
protected  java.lang.String encodeValue(java.lang.String value)
          Override to perform special encoding in subclass.
 boolean equals(java.lang.Object o)
          Compares key and value before encoding.
protected abstract  java.lang.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.support.filter.AbstractFilter
encode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompareFilter

public CompareFilter(java.lang.String attribute,
                     java.lang.String value)

CompareFilter

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

Parameters:
attribute -
value -
Method Detail

encodeValue

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

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

encode

public java.lang.StringBuffer encode(java.lang.StringBuffer buff)
Description copied from class: AbstractFilter
Prints the query with LDAP encoding to a stringbuffer

Specified by:
encode in interface Filter
Specified by:
encode in class AbstractFilter
Parameters:
buff - The stringbuffer
Returns:
The very same stringbuffer

equals

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

See Also:
Filter.equals(java.lang.Object)

hashCode

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

See Also:
Filter.hashCode()

getCompareString

protected abstract java.lang.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.


Copyright � 2002-2006. All Rights Reserved.