Package com.rometools.modules.sle
Class SleUtility
- java.lang.Object
-
- com.rometools.modules.sle.SleUtility
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Extendable>
List<T>group(List<T> values, Group[] groups)Groups values by the groups from the SLE.static voidinitializeForSorting(SyndFeed feed)This method will take a SyndFeed object with a SimpleListExtension on it and populate the entries with current SleEntry values for sorting and grouping.static <T extends Extendable>
List<T>sort(List<T> values, Sort sort, boolean ascending)Sorts a list of values based on a given sort field using a selection sort.static <T extends Extendable>
List<T>sortAndGroup(List<T> values, Group[] groups, Sort sort, boolean ascending)Sorts and groups a set of entries.
-
-
-
Method Detail
-
group
public static <T extends Extendable> List<T> group(List<T> values, Group[] groups)
Groups values by the groups from the SLE.- Parameters:
values- List of Extendable implementations to group.groups- Group fields (from the SimpleListExtension module)- Returns:
- Grouped list of entries.
-
sort
public static <T extends Extendable> List<T> sort(List<T> values, Sort sort, boolean ascending)
Sorts a list of values based on a given sort field using a selection sort.- Parameters:
values- List of values (implements Extendable) to sort.sort- The sort field to sort on.ascending- Sort ascending/descending.- Returns:
- Sorted list of values
-
sortAndGroup
public static <T extends Extendable> List<T> sortAndGroup(List<T> values, Group[] groups, Sort sort, boolean ascending)
Sorts and groups a set of entries.- Parameters:
values- List of Extendable implementations.groups- Group items to group by.sort- Field to sort on.ascending- Sort ascending/descending- Returns:
- Grouped and sorted list of entries.
-
initializeForSorting
public static void initializeForSorting(SyndFeed feed) throws FeedException
This method will take a SyndFeed object with a SimpleListExtension on it and populate the entries with current SleEntry values for sorting and grouping. NB: This basically does this by re-generating the XML for all the entries then re-parsing them into the SLE data structures. It is a very heavy operation and should not be called frequently!- Throws:
FeedException
-
-