Class RepositoryUtil.ComparatorBuilder<T>

java.lang.Object
io.jmix.reports.impl.repository.RepositoryUtil.ComparatorBuilder<T>
Enclosing class:
RepositoryUtil

public class RepositoryUtil.ComparatorBuilder<T> extends Object
  • Method Details

    • build

      public Comparator<T> build(Sort sort)
      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 clients
      valueExtractor - function to extract comparable value from the entity, similar to Comparator.comparing(Function)
      Returns:
      builder object