Interface Sorter<TT>

Type Parameters:
TT - Entity Type

Example:

@Named
@ViewScoped
public class SortingDataModel implements Serializable {
    @Inject
    @Getter
    JPALazyDataModel<UserEntity, Long> userModel;

    @PostConstruct
    void initialize() {
        // add an ascending zip code-based sort order
        userModel.initialize(builder -> builder.sorter((sortData, cb, root) ->
                        sortData.applicationSort(UserEntity_.zipCode.getName(),
                        var -> cb.asc(root.get(UserEntity_.zipCode))))
                .build());
    }
}
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Sorter<TT>
Sorter Hook
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Sort order requested by the UI lives in Sorter.MergedSortOrder.requestedSortMeta, Sort order requested by the application lives in Sorter.MergedSortOrder.applicationSort Only one can exist, the other will always be null.
    static class 
    Manipulates sort criteria requested from the UI and possibly adds or replaces it with application-based sort criteria
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    sort(Sorter.SortData sortData, CriteriaBuilder cb, Root<TT> root)
    Hook for sort criteria manipulation.