Class CompareFilter

java.lang.Object
org.springframework.ldap.filter.AbstractFilter
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.
  • Constructor Details

    • 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 Details

    • 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.
      Parameters:
      buff - The StringBuffer to encode the filter to
      Returns:
      The same StringBuffer as was given
    • equals

      public boolean equals(Object o)
      Description copied from interface: Filter
      All filters must implement equals.
      Specified by:
      equals in interface Filter
      Overrides:
      equals in class Object
      Returns:
      true if the objects are equal.
    • hashCode

      public int hashCode()
      Description copied from interface: Filter
      All filters must implement hashCode.
      Specified by:
      hashCode in interface Filter
      Overrides:
      hashCode in class Object
      Returns:
      the hash code according to the contract in Object.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.