com.interface21.beans
Class PropertyComparator
java.lang.Object
|
+--com.interface21.beans.PropertyComparator
- All Implemented Interfaces:
- java.util.Comparator
- public class PropertyComparator
- extends java.lang.Object
- implements java.util.Comparator
PropertyComparator performs a comparison of two beans,
using the specified bean property via a BeanWrapper.
- Since:
- 19.05.2003
- Author:
- Juergen Hoeller
|
Method Summary |
int |
compare(java.lang.Object o1,
java.lang.Object o2)
|
static void |
sort(java.util.List source,
SortDefinition sortDefinition)
Sorts the given List according to the given sort definition.
|
static void |
sort(java.lang.Object[] source,
SortDefinition sortDefinition)
Sorts the given source according to the given sort definition.
|
| 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 |
PropertyComparator
public PropertyComparator(SortDefinition sortDefinition)
compare
public int compare(java.lang.Object o1,
java.lang.Object o2)
- Specified by:
compare in interface java.util.Comparator
sort
public static void sort(java.util.List source,
SortDefinition sortDefinition)
throws BeansException
- Sorts the given List according to the given sort definition.
Note: Contained objects have to provide the given property
in the form of a bean property, i.e. a getXXX method.
- Parameters:
source - the input ListsortDefinition - the parameters to sort by- Throws:
java.lang.IllegalArgumentException - in case of a missing propertyName
sort
public static void sort(java.lang.Object[] source,
SortDefinition sortDefinition)
throws BeansException
- Sorts the given source according to the given sort definition.
Note: Contained objects have to provide the given property
in the form of a bean property, i.e. a getXXX method.
- Parameters:
source - input sourcesortDefinition - the parameters to sort by- Throws:
java.lang.IllegalArgumentException - in case of a missing propertyName
Rod Johnson and Spring contributors 2001-2003.