org.apache.commons.collections.comparators
Class TransformingComparator

java.lang.Object
  |
  +--org.apache.commons.collections.comparators.TransformingComparator

public class TransformingComparator
extends Object
implements Comparator

Decorates another Comparator with transformation behavior. That is, the return value from the transform operation will be passed to the decorated Comparator#compare method.

See Also:
Transformer, ComparableComparator

Field Summary
protected  Comparator decorated
           
protected  Transformer transformer
           
 
Constructor Summary
TransformingComparator(Transformer transformer)
          Constructs an instance with the given Transformer and a ComparableComparator.
TransformingComparator(Transformer transformer, Comparator decorated)
          Constructs an instance with the given Transformer and Comparator
 
Method Summary
 int compare(Object o1, Object o2)
          Returns the result of comparing the values from the transform operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decorated

protected Comparator decorated

transformer

protected Transformer transformer
Constructor Detail

TransformingComparator

public TransformingComparator(Transformer transformer)
Constructs an instance with the given Transformer and a ComparableComparator.
Parameters:
transformer - what will transform the instance.

TransformingComparator

public TransformingComparator(Transformer transformer,
                              Comparator decorated)
Constructs an instance with the given Transformer and Comparator
Parameters:
decorated - the decorated Comparator
getterName - the getter name
Method Detail

compare

public int compare(Object o1,
                   Object o2)
Returns the result of comparing the values from the transform operation.
Specified by:
compare in interface Comparator
Returns:
the result of comparing the values from the transform operation


Copyright © 2001-2002 Apache Software Foundation. Documenation generated October 21 2002.