toolbox.app
Class AppBeanComparator

Package class diagram package AppBeanComparator
java.lang.Object
  extended by toolbox.app.MapComparator
      extended by toolbox.app.AppBeanComparator
All Implemented Interfaces:
java.util.Comparator

public class AppBeanComparator
extends MapComparator
implements java.util.Comparator

Comparator implementation to compare the values contained within AppBean implementations.

It can be used to sort Lists that store instances of AppBean implementations.


Constructor Summary
AppBeanComparator(java.lang.Object key, 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 key.
 
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
 

Constructor Detail

AppBeanComparator

public AppBeanComparator(java.lang.Object key,
                         java.lang.String order)
Construct a new instance.

Parameters:
key - Key that must be used to obtain values from the Map contained in the AppBean
order - String indicating the sort order. Specify "asc" for ascending order and "desc" for descending order.
Method Detail

compare

public int compare(java.lang.Object obj1,
                   java.lang.Object obj2)
Compare the values mapped to the specified key.

Specified by:
compare in interface java.util.Comparator
Overrides:
compare in class MapComparator
Parameters:
obj1 - First AppBean
obj2 - Second AppBean
Returns:
int indicating the result of the comparison.