Class Queryable.Order<T,U extends Comparable<? super U>>

java.lang.Object
org.apache.groovy.ginq.provider.collection.runtime.Queryable.Order<T,U>
Type Parameters:
T - the type of element from Queryable instance
U - the type of field to sort
Enclosing interface:
Queryable<T>

public static class Queryable.Order<T,U extends Comparable<? super U>> extends Object
Represents an order rule
Since:
4.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Queryable.Order[]
    Shared empty array for order clauses.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Order(Function<? super T,? extends U> keyExtractor, boolean asc)
    Creates an order rule with nulls sorted last.
    Order(Function<? super T,? extends U> keyExtractor, boolean asc, boolean nullsLast)
    Creates an order rule.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares this rule with another one.
    Function<? super T,? extends U>
    Returns the sort key extractor.
    int
    Returns the hash code of this rule.
    boolean
    Indicates whether this rule sorts ascending.
    boolean
    Indicates whether this rule places null values last.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EMPTY_ARRAY

      public static final Queryable.Order[] EMPTY_ARRAY
      Shared empty array for order clauses.
  • Constructor Details

    • Order

      public Order(Function<? super T,? extends U> keyExtractor, boolean asc)
      Creates an order rule with nulls sorted last.
      Parameters:
      keyExtractor - the sort key extractor
      asc - whether to sort ascending
    • Order

      public Order(Function<? super T,? extends U> keyExtractor, boolean asc, boolean nullsLast)
      Creates an order rule.
      Parameters:
      keyExtractor - the sort key extractor
      asc - whether to sort ascending
      nullsLast - whether nulls should be ordered last
  • Method Details

    • getKeyExtractor

      public Function<? super T,? extends U> getKeyExtractor()
      Returns the sort key extractor.
      Returns:
      the sort key extractor
    • isAsc

      public boolean isAsc()
      Indicates whether this rule sorts ascending.
      Returns:
      true for ascending order
    • isNullsLast

      public boolean isNullsLast()
      Indicates whether this rule places null values last.
      Returns:
      true if nulls are ordered last
    • equals

      public boolean equals(Object o)
      Compares this rule with another one.
      Overrides:
      equals in class Object
      Parameters:
      o - the other object
      Returns:
      true if both rules are equal
    • hashCode

      public int hashCode()
      Returns the hash code of this rule.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code