Interface Sorter<TT>
- Type Parameters:
TT
- Entity TypeExample:
@Named @ViewScoped public class SortingDataModel implements Serializable { @Inject @Getter JPALazyDataModel<UserEntity> 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.
Sorter Hook
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Sort order requested by the UI lives inSorter.MergedSortOrder.requestedSortMeta
, Sort order requested by the application lives inSorter.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 TypeMethodDescriptionvoid
sort
(Sorter.SortData sortData, CriteriaBuilder cb, Root<TT> root) Hook for sort criteria manipulation.
-
Method Details
-
sort
Hook for sort criteria manipulation. Application can inspect or remove elements from theSorter.SortData.sortOrder
map and add your own sort order viaSorter.SortData.applicationSort(String, Function)
method- Parameters:
sortData
- merged sort criteriacb
-CriteriaBuilder
root
-Root
-