| java.lang.Object org.andromda.utils.beans.BeanSorter
BeanSorter | public class BeanSorter (Code) | | Provides bean sorting capabilities.
Sorts passed in Collections and returns
sorted Lists. Performs sorting for any
Class that has an associated Comparator implementation defined. If
the Collection that is passed in, is not an instance of List, it will create
a new ArrayList with the contents of the passed in Collection, before
sorting occurs (since sorting can only be done on a java.util.List).
author: Chad Brandon |
Method Summary | |
public static List | sort(Collection beans, String sortBy, Ordering ordering) Performs sorting of the collection by one property to
sort with more than one property see
sort(java.util.Collection, SortCriteria[]) .
See Also: sort(java.util.Collection, SortCriteria[]) Parameters: beans - the Collection of PersistentObjects to sort Parameters: sortBy - the property to sort by (i.e. | public static List | sort(Collection beans, SortCriteria[] sortBy)
Sorts the passed in Collection and returns
a sorted List. |
sort | public static List sort(Collection beans, String sortBy, Ordering ordering)(Code) | | Performs sorting of the collection by one property to
sort with more than one property see
sort(java.util.Collection, SortCriteria[]) .
See Also: sort(java.util.Collection, SortCriteria[]) Parameters: beans - the Collection of PersistentObjects to sort Parameters: sortBy - the property to sort by (i.e. firstName, etc). Canbe a nested property such as 'person.address.street'. Parameters: ordering - the ordering of the sorting (either SortCriteria.ASENDINGor SortCriteria.DESCENDING) the sorted List |
sort | public static List sort(Collection beans, SortCriteria[] sortBy)(Code) | |
Sorts the passed in Collection and returns
a sorted List. Performs SQL like sorting for any
Class that has an associated Comparator implementation defined. If
the Collection that is passed in, is not an instance of List, it will create
a new ArrayList with the contents of the passed in Collection, before
sorting occurs. Since sorting can only be done on a java.util.List.
Parameters: beans - the Collection of PersistentObjects to sort Parameters: sortBy - an array of SortCriteria. This array of SortCriteriaspecifies which attributes to sort by. You can also specify whether you wantSortCriteria.ASCENDING or SortCriteria.DESCENDING ordering for each attribute.Attributes to sort by, MUST be simple attributes (i.e. name, type, etc, they can not be complex objects, but the properties can be nested simple types within associated beans). List the sorted List |
|
|