org.springframework.beans.support
Class PropertyComparator


public class PropertyComparator
implements Comparator

PropertyComparator performs a comparison of two beans, using the specified bean property via a BeanWrapper.

Author:
Juergen Hoeller, Jean-Pierre Pawlak
Since: 19.05.2003

Constructor Summary
PropertyComparator(SortDefinition sortDefinition)
           

Method Summary
 intcompare(Object o1, Object o2)
           
 static voidsort(List source, SortDefinition sortDefinition)
          Sorts the given List according to the given sort definition.
 static voidsort(Object[] source, SortDefinition sortDefinition)
          Sorts the given source according to the given sort definition.

Constructor Detail

PropertyComparator

public PropertyComparator(SortDefinition sortDefinition)
Method Detail

compare

public int compare(Object o1, Object o2)

sort

public static void sort(List source, SortDefinition sortDefinition)
throws org.springframework.beans.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 List
sortDefinition - the parameters to sort by
Throws:
java.lang.IllegalArgumentException - in case of a missing propertyName

sort

public static void sort(Object[] source, SortDefinition sortDefinition)
throws org.springframework.beans.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 source
sortDefinition - the parameters to sort by
Throws:
java.lang.IllegalArgumentException - in case of a missing propertyName

Association Links

to Class org.springframework.beans.support.SortDefinition

to Class java.util.Map