toolbox.dao
Class DaoBeanComparator
java.lang.Object
toolbox.dao.DaoBeanComparator
- All Implemented Interfaces:
- java.util.Comparator
public class DaoBeanComparator
- extends java.lang.Object
- implements java.util.Comparator
Comparator implementation to compare the property values of
toolbox.dao.DaoBean
instances.
It can be used to sort Lists that store collections of DaoBeans.
Constructor Summary |
DaoBeanComparator(java.lang.String prop,
java.lang.String order)
Construct a new instance. |
Method Summary |
int |
compare(java.lang.Object obj1,
java.lang.Object obj2)
Compare the values mapped to the specified property. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
DaoBeanComparator
public DaoBeanComparator(java.lang.String prop,
java.lang.String order)
- Construct a new instance.
- Parameters:
prop
- Property that must be used to obtain a value from the bean.order
- String indicating the sort order. Specify "asc" for
ascending order and "desc" for descending order.
compare
public int compare(java.lang.Object obj1,
java.lang.Object obj2)
- Compare the values mapped to the specified property.
- Specified by:
compare
in interface java.util.Comparator
- Parameters:
obj1
- First Mapobj2
- Second Map
- Returns:
- int indicating the result of the comparison.