Class SortingImpl

java.lang.Object
de.digitalcollections.model.impl.paging.SortingImpl
All Implemented Interfaces:
Sorting, java.io.Serializable, java.lang.Iterable<Order>

public class SortingImpl
extends java.lang.Object
implements Sorting
SortingImpl option for queries. You have to provide at least a list of properties to sort for that must not include null or empty strings. The direction defaults to Sorting.DEFAULT_DIRECTION. See Spring Data Commons, but more flat design and independent of Spring libraries.
See Also:
Serialized Form
  • Nested Class Summary

    Nested classes/interfaces inherited from interface de.digitalcollections.model.api.paging.Sorting

    Sorting.Builder
  • Field Summary

    Fields inherited from interface de.digitalcollections.model.api.paging.Sorting

    DEFAULT_DIRECTION
  • Constructor Summary

    Constructors
    Constructor Description
    SortingImpl()  
    SortingImpl​(Direction direction, java.lang.String... properties)
    Creates a new Sorting instance.
    SortingImpl​(Direction direction, java.util.List<java.lang.String> properties)
    Creates a new Sorting instance.
    SortingImpl​(Order... orders)
    Creates a new Sorting instance using the given Orders.
    SortingImpl​(java.lang.String... properties)
    Creates a new Sorting instance.
    SortingImpl​(java.util.List<Order> orders)
    Creates a new Sorting instance.
  • Method Summary

    Modifier and Type Method Description
    Sorting and​(Sorting sort)
    Returns a new SortingImpl consisting of the Orders of the current SortingImpl combined with the given ones.
    boolean equals​(java.lang.Object obj)  
    Order getOrderFor​(java.lang.String property)
    Returns the order registered for the given property.
    java.util.List<Order> getOrders()  
    int hashCode()  
    java.util.Iterator<Order> iterator()  
    void setOrders​(java.util.List<Order> orders)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Constructor Details

    • SortingImpl

      public SortingImpl()
    • SortingImpl

      public SortingImpl​(Order... orders)
      Creates a new Sorting instance using the given Orders.
      Parameters:
      orders - must not be null.
    • SortingImpl

      public SortingImpl​(java.util.List<Order> orders)
      Creates a new Sorting instance.
      Parameters:
      orders - must not be null or contain null.
    • SortingImpl

      public SortingImpl​(java.lang.String... properties)
      Creates a new Sorting instance. Order defaults to Direction#ASC.
      Parameters:
      properties - must not be null or contain null or empty strings
    • SortingImpl

      public SortingImpl​(Direction direction, java.lang.String... properties)
      Creates a new Sorting instance.
      Parameters:
      direction - defaults to Sorting.DEFAULT_DIRECTION (for null cases, too)
      properties - must not be null, empty or contain null or empty strings.
    • SortingImpl

      public SortingImpl​(Direction direction, java.util.List<java.lang.String> properties)
      Creates a new Sorting instance.
      Parameters:
      direction - defaults to Sorting.DEFAULT_DIRECTION (for null cases, too)
      properties - must not be null or contain null or empty strings.
  • Method Details

    • getOrders

      public java.util.List<Order> getOrders()
      Specified by:
      getOrders in interface Sorting
    • setOrders

      public void setOrders​(java.util.List<Order> orders)
    • and

      public Sorting and​(Sorting sort)
      Returns a new SortingImpl consisting of the Orders of the current SortingImpl combined with the given ones.
      Specified by:
      and in interface Sorting
      Parameters:
      sort - can be null.
      Returns:
      a new combined sort
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • getOrderFor

      public Order getOrderFor​(java.lang.String property)
      Returns the order registered for the given property.
      Specified by:
      getOrderFor in interface Sorting
      Parameters:
      property - given property
      Returns:
      the order registered for the given property
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • iterator

      public java.util.Iterator<Order> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<Order>
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object