net.sf.ldaptemplate.support.filter
Class CompareFilter

java.lang.Object
  extended bynet.sf.ldaptemplate.support.filter.AbstractFilter
      extended bynet.sf.ldaptemplate.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, e.g. EqualsFilter.

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, e.g. the Equals sign, "=".
 int hashCode()
          hash attribute and value
 
Methods inherited from class net.sf.ldaptemplate.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
See Also:
Filter.encode(java.lang.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()
hash attribute and value

See Also:
Filter.hashCode()

getCompareString

protected abstract java.lang.String getCompareString()
Implement this method in subclass to return a String representing the operator, e.g. the Equals sign, "=".

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


Copyright © 2006 Jayway AB. All Rights Reserved.