Package io.jmix.reports.impl.repository
Class RepositoryUtil.ComparatorBuilder<T>
java.lang.Object
io.jmix.reports.impl.repository.RepositoryUtil.ComparatorBuilder<T>
- Enclosing class:
- RepositoryUtil
-
Method Summary
Modifier and TypeMethodDescriptionBuild comparator.<U extends Comparable<? super U>>
RepositoryUtil.ComparatorBuilder<T>customProperty(String sortKey, Function<T, ? extends U> valueExtractor) Register additional custom comparator for a sort key which isn't a property of the entity, e.g.
-
Method Details
-
build
Build comparator. Checks that sort keys are valid.- Parameters:
sort- sort clauses- Returns:
- prepared comparator
-
customProperty
public <U extends Comparable<? super U>> RepositoryUtil.ComparatorBuilder<T> customProperty(String sortKey, Function<T, ? extends U> valueExtractor) Register additional custom comparator for a sort key which isn't a property of the entity, e.g. for a calculatable property. A value extractor function must be provided. Extracted values are cached, to avoid repeated computations of the same value.- Type Parameters:
U- type of comparable value- Parameters:
sortKey- sort key, expected to be used by repository clientsvalueExtractor- function to extract comparable value from the entity, similar toComparator.comparing(Function)- Returns:
- builder object
-