Class ExpressionOrder

java.lang.Object
io.micronaut.data.model.Sort.Order
io.micronaut.data.model.jpa.criteria.impl.ExpressionOrder

@Internal public final class ExpressionOrder extends Sort.Order
A Sort.Order that orders by an arbitrary expression rather than by an attribute name. Only the criteria based query paths can honour it; they recognize this type and ask it for the criteria expression to order by.
Since:
5.2
Author:
Denis Stepanov
  • Constructor Details

    • ExpressionOrder

      public ExpressionOrder(String description, Sort.Order.Direction direction, boolean ignoreCase, Sort.Order.NullOrdering nullOrdering, BiFunction<jakarta.persistence.criteria.Root<?>, jakarta.persistence.criteria.CriteriaBuilder, jakarta.persistence.criteria.Expression<Object>> expressionFactory)
      Default constructor.
      Parameters:
      description - A human readable description of the expression, used as the order's property name
      direction - The direction
      ignoreCase - Whether to ignore case
      nullOrdering - Where to place null values relative to non-null values
      expressionFactory - Builds the criteria expression to order by
  • Method Details

    • toExpression

      public jakarta.persistence.criteria.Expression<Object> toExpression(jakarta.persistence.criteria.Root<?> root, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)
      Builds the criteria expression to order by.
      Parameters:
      root - The criteria root
      criteriaBuilder - The criteria builder
      Returns:
      The expression to order by
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Sort.Order
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Sort.Order