|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jagg.PropertiesComparator<T>
public class PropertiesComparator<T>
This class represents a flexible Comparator that is capable of
comparing two objects based on a dynamic list of properties of the objects
of type T. This class is used internally by
Aggregation to sort a List<T> according to
a specified list of properties.
| Constructor Summary | |
|---|---|
PropertiesComparator(java.util.List<java.lang.String> properties)
Construct a PropertiesComparator that pays attention to the
given List of properties in the generic type T. |
|
| Method Summary | |
|---|---|
int |
compare(T o1,
T o2)
Compares the given objects to determine order. |
boolean |
equals(java.lang.Object obj)
Indicates whether the given PropertiesComparator is equal to
this PropertiesComparator. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PropertiesComparator(java.util.List<java.lang.String> properties)
PropertiesComparator that pays attention to the
given List of properties in the generic type T.
All properties must be Comparable.
properties - A List<String> of properties.| Method Detail |
|---|
public int compare(T o1,
T o2)
throws java.lang.UnsupportedOperationException
Compares the given objects to determine order. Fulfills the
Comparator contract by returning a negative integer, 0, or a
positive integer if o1 is less than, equal to, or greater
than o2.
Nulls properties compare equal to each other, and a null property compares greater than a non-null property.
compare in interface java.util.Comparator<T>o1 - The left-hand-side object to compare.o2 - The right-hand-side object to compare.
o1
is less than, equal to, or greater than o2.
java.lang.UnsupportedOperationException - If any property specified in the
constructor doesn't correspond to a no-argument "get<Property>"
getter method in T, or if the property's type is not
Comparable.public boolean equals(java.lang.Object obj)
PropertiesComparator is equal to
this PropertiesComparator. All property names must match in
order.
equals in interface java.util.Comparator<T>equals in class java.lang.Objectobj - The other PropertiesComparator.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||