Package org.kiwiproject.spring.data
Class KiwiSort
java.lang.Object
org.kiwiproject.spring.data.KiwiSort
Describes a sort on a specific property that is applied to a result list.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSpecifies that the sort is not case-sensitive, i.e. it ignores case.booleanbooleanConvenience method to allow checking if thisKiwiSortis descending.booleanstatic KiwiSortCreate a new instance.static KiwiSortof(String property, KiwiSort.Direction direction) Create a new instance.static KiwiSortofAscending(String property) Create a new instance with ascending sort direction.static KiwiSortofDescending(String property) Create a new instance with descending sort direction.voidsetAscending(boolean ascending) voidsetDirection(String direction) voidsetDirectionObject(KiwiSort.Direction directionObject) voidsetIgnoreCase(boolean ignoreCase) voidsetProperty(String property) toString()
-
Constructor Details
-
KiwiSort
public KiwiSort()
-
-
Method Details
-
ofAscending
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
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
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 todirection- the sort direction as a String, which must resolve viaKiwiSort.Direction.fromString(String)- Returns:
- a new instance
- Throws:
IllegalArgumentException- if property is blank or direction is blank or invalid
-
of
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 todirection- the sort direction- Returns:
- a new instance
- Throws:
IllegalArgumentException- if property is blank or direction is null
-
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 thisKiwiSortis descending.- Returns:
- true if this sort is descending, false if ascending
-
getDirectionObject
-
getDirection
-
getProperty
-
isIgnoreCase
public boolean isIgnoreCase() -
isAscending
public boolean isAscending() -
setDirectionObject
-
setDirection
-
setProperty
-
setIgnoreCase
public void setIgnoreCase(boolean ignoreCase) -
setAscending
public void setAscending(boolean ascending) -
toString
-