Class SimpleSortDescriptor

java.lang.Object
net.solarnetwork.domain.SimpleSortDescriptor
All Implemented Interfaces:
SortDescriptor

public class SimpleSortDescriptor extends Object implements SortDescriptor
Implementation of SortDescriptor.
Version:
1.1
Author:
matt
  • Constructor Details

    • SimpleSortDescriptor

      public SimpleSortDescriptor(String sortKey)
      Construct with a sort key. Ascending order will be used.
      Parameters:
      sortKey - the sort key
    • SimpleSortDescriptor

      public SimpleSortDescriptor(String sortKey, boolean descending)
      Constructor.
      Parameters:
      sortKey - the sort key
      descending - the descending flag
  • Method Details

    • sorts

      public static List<SortDescriptor> sorts(String... keys)
      Create a list of ascending sort descriptors.
      Parameters:
      keys - the sort keys
      Returns:
      the descriptors, or null if keys has no elements
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getSortKey

      public String getSortKey()
      Description copied from interface: SortDescriptor
      Get the name of the value to sort by.

      How this value is interpreted is implementation dependent.

      Specified by:
      getSortKey in interface SortDescriptor
      Returns:
      the sort key
    • isDescending

      public boolean isDescending()
      Description copied from interface: SortDescriptor
      Return true if the sort should be in descending order, otherwise the short should be in ascending order.
      Specified by:
      isDescending in interface SortDescriptor
      Returns:
      true if the sort should be in descending order