Class KiwiSort

java.lang.Object
org.kiwiproject.spring.data.KiwiSort

public class KiwiSort extends Object
Describes a sort on a specific property that is applied to a result list.
  • Constructor Details

    • KiwiSort

      public KiwiSort()
  • Method Details

    • ofAscending

      public static KiwiSort ofAscending(String property)
      Create a new instance with ascending sort direction.

      If you want to specify that the sort is not case-sensitive, you can immediately call the ignoringCase() in a fluent style.

      Parameters:
      property - the property the sort is applied to
      Returns:
      a new instance
    • ofDescending

      public static KiwiSort ofDescending(String property)
      Create a new instance with descending sort direction.

      If you want to specify that the sort is not case-sensitive, you can immediately call the ignoringCase() in a fluent style.

      Parameters:
      property - the property the sort is applied to
      Returns:
      a new instance
    • of

      public static KiwiSort of(String property, String direction)
      Create a new instance.

      If you want to specify that the sort is not case-sensitive, you can immediately call the ignoringCase() in a fluent style.

      Parameters:
      property - the property the sort is applied to
      direction - the sort direction as a String, which must resolve via KiwiSort.Direction.fromString(String)
      Returns:
      a new instance
      Throws:
      IllegalArgumentException - if property is blank or direction is blank or invalid
    • of

      public static KiwiSort of(String property, KiwiSort.Direction direction)
      Create a new instance.

      If you want to specify that the sort is not case-sensitive, you can immediately call the ignoringCase() in a fluent style.

      Parameters:
      property - the property the sort is applied to
      direction - the sort direction
      Returns:
      a new instance
      Throws:
      IllegalArgumentException - if property is blank or direction is null
    • ignoringCase

      public KiwiSort ignoringCase()
      Specifies that the sort is not case-sensitive, i.e. it ignores case.
      Returns:
      this instance, for method chaining
    • isDescending

      public boolean isDescending()
      Convenience method to allow checking if this KiwiSort is descending.
      Returns:
      true if this sort is descending, false if ascending
    • getDirectionObject

      public KiwiSort.Direction getDirectionObject()
    • getDirection

      public String getDirection()
    • getProperty

      public String getProperty()
    • isIgnoreCase

      public boolean isIgnoreCase()
    • isAscending

      public boolean isAscending()
    • setDirectionObject

      public void setDirectionObject(KiwiSort.Direction directionObject)
    • setDirection

      public void setDirection(String direction)
    • setProperty

      public void setProperty(String property)
    • setIgnoreCase

      public void setIgnoreCase(boolean ignoreCase)
    • setAscending

      public void setAscending(boolean ascending)
    • toString

      public String toString()
      Overrides:
      toString in class Object