package org.beanfabrics.model; import java.util.List; import org.beanfabrics.Path; import org.beanfabrics.util.OrderPreservingMap; /** * The {@link Sorter} provides methods for sorting collections of PM objects by * a list of {@link SortKey}s. * <p> * Each sort key defines a {@link Path} to the PM's child node that should be * used as sort field. The comparison itself is delegated to a * {@link Comparable} substitute generated by the sort field's * {@link PresentationModel#getComparable()} method. * <p> * * @author KarneimM */ public interface Sorter { /** * Sorts the given map by the specified sort keys. * * @param <K> * @param <V> * @param map the map to be sorted * @param sortKeys the sort keys for the sorting */ public <K, V extends PresentationModel> void sortBy(OrderPreservingMap<K, V> map, SortKey... sortKeys); /** * Sorts the given list by the specified sort keys. * * @param <T> * @param list the list to be sorted * @param sortKeys the sort keys for the sorting */ public <T extends PresentationModel> void sortBy(List<T> list, SortKey... sortKeys); }