Package org.springframework.data.domain
Class Sort.Order
java.lang.Object
org.springframework.data.domain.Sort.Order
- All Implemented Interfaces:
Serializable
- Enclosing class:
- Sort
PropertyPath implements the pairing of an
Sort.Direction
and a property. It is used to provide input for
Sort
- Author:
- Oliver Gierke, Kevin Raymond, Jens Schauder
- See Also:
-
Constructor Summary
ConstructorDescriptionOrder
(Sort.Direction direction, String property) Creates a newSort.Order
instance. if order is null then order defaults toSort.DEFAULT_DIRECTION
Order
(Sort.Direction direction, String property, boolean ignoreCase, Sort.NullHandling nullHandling) Creates a newSort.Order
instance. if order is null then order defaults toSort.DEFAULT_DIRECTION
Order
(Sort.Direction direction, String property, Sort.NullHandling nullHandlingHint) Creates a newSort.Order
instance. if order is null then order defaults toSort.DEFAULT_DIRECTION
-
Method Summary
Modifier and TypeMethodDescriptionstatic Sort.Order
Creates a newSort.Order
instance.static Sort.Order
Creates a newSort.Order
instance.static Sort.Order
Creates a newSort.Order
instance.boolean
Returns the order the property shall be sorted for.Returns the usedSort.NullHandling
hint, which can but may not be respected by the used datastore.Returns the property to order for.int
hashCode()
Returns a newSort.Order
with case-insensitive sorting enabled.boolean
Returns whether sorting for this property shall be ascending.boolean
Returns whether sorting for this property shall be descending.boolean
Returns whether the sort will be case-sensitive or case-insensitive.Returns a newSort.Order
withSort.NullHandling.NULLS_FIRST
as null handling hint applied.Returns a newSort.Order
withSort.NullHandling.NULLS_LAST
as null handling hint applied.Returns a newSort.Order
withSort.NullHandling.NATIVE
as null handling hint applied.reverse()
Returns a newSort.Order
with the reversedgetDirection()
applied.toString()
with
(Sort.Direction direction) Returns a newSort.Order
with the givenSort.Direction
applied.with
(Sort.NullHandling nullHandling) Returns aSort.Order
with the givenSort.NullHandling
applied.withProperties
(String... properties) Returns a newSort
instance for the given properties usinggetDirection()
.withProperty
(String property) Returns a newSort.Order
with theproperty
name applied.
-
Constructor Details
-
Order
Creates a newSort.Order
instance. if order is null then order defaults toSort.DEFAULT_DIRECTION
- Parameters:
direction
- can be null, will default toSort.DEFAULT_DIRECTION
property
- must not be null or empty.
-
Order
public Order(@Nullable Sort.Direction direction, String property, Sort.NullHandling nullHandlingHint) Creates a newSort.Order
instance. if order is null then order defaults toSort.DEFAULT_DIRECTION
- Parameters:
direction
- can be null, will default toSort.DEFAULT_DIRECTION
property
- must not be null or empty.nullHandlingHint
- must not be null.
-
Order
public Order(@Nullable Sort.Direction direction, String property, boolean ignoreCase, Sort.NullHandling nullHandling) Creates a newSort.Order
instance. if order is null then order defaults toSort.DEFAULT_DIRECTION
- Parameters:
direction
- can be null, will default toSort.DEFAULT_DIRECTION
property
- must not be null or empty.ignoreCase
- true if sorting should be case-insensitive. false if sorting should be case-sensitive.nullHandling
- must not be null.- Since:
- 1.7
-
-
Method Details
-
by
Creates a newSort.Order
instance. Takes a single property. Direction defaults toSort.DEFAULT_DIRECTION
.- Parameters:
property
- must not be null or empty.- Since:
- 2.0
-
asc
Creates a newSort.Order
instance. Takes a single property. Direction isSort.Direction.ASC
and NullHandlingSort.NullHandling.NATIVE
.- Parameters:
property
- must not be null or empty.- Since:
- 2.0
-
desc
Creates a newSort.Order
instance. Takes a single property. Direction isSort.Direction.DESC
and NullHandlingSort.NullHandling.NATIVE
.- Parameters:
property
- must not be null or empty.- Since:
- 2.0
-
getDirection
Returns the order the property shall be sorted for.- Returns:
- the order the property shall be sorted for.
-
getProperty
Returns the property to order for.- Returns:
- the property to order for.
-
isAscending
public boolean isAscending()Returns whether sorting for this property shall be ascending.- Returns:
- true if ascending, false otherwise.
-
isDescending
public boolean isDescending()Returns whether sorting for this property shall be descending.- Returns:
- true if descending, false otherwise.
- Since:
- 1.13
-
isIgnoreCase
public boolean isIgnoreCase()Returns whether the sort will be case-sensitive or case-insensitive.- Returns:
- true if the sort will be case-sensitive or case-insensitive, false otherwise.
-
with
Returns a newSort.Order
with the givenSort.Direction
applied.- Parameters:
direction
- the new direction to use.- Returns:
- a new
Sort.Order
with the givenSort.Direction
applied.
-
reverse
Returns a newSort.Order
with the reversedgetDirection()
applied.- Returns:
- a reversed
Sort.Order
with the givenSort.Direction
applied. - Since:
- 3.1
-
withProperty
Returns a newSort.Order
with theproperty
name applied.- Parameters:
property
- must not be null or empty.- Returns:
- a new
Sort.Order
with theproperty
name applied. - Since:
- 1.13
-
withProperties
Returns a newSort
instance for the given properties usinggetDirection()
.- Parameters:
properties
- properties to sort by.- Returns:
- a new
Sort
instance for the given properties usinggetDirection()
.
-
ignoreCase
Returns a newSort.Order
with case-insensitive sorting enabled.- Returns:
- a new
Sort.Order
with case-insensitive sorting enabled.
-
with
Returns aSort.Order
with the givenSort.NullHandling
applied.- Parameters:
nullHandling
- can be null.- Returns:
- a new
Sort.Order
with the givenSort.NullHandling
applied. - Since:
- 1.8
-
nullsFirst
Returns a newSort.Order
withSort.NullHandling.NULLS_FIRST
as null handling hint applied.- Returns:
- a new
Sort.Order
withSort.NullHandling.NULLS_FIRST
as null handling hint applied. - Since:
- 1.8
-
nullsLast
Returns a newSort.Order
withSort.NullHandling.NULLS_LAST
as null handling hint applied.- Returns:
- a new
Sort.Order
withSort.NullHandling.NULLS_LAST
as null handling hint applied. - Since:
- 1.7
-
nullsNative
Returns a newSort.Order
withSort.NullHandling.NATIVE
as null handling hint applied.- Returns:
- a new
Sort.Order
withSort.NullHandling.NATIVE
as null handling hint applied. - Since:
- 1.7
-
getNullHandling
Returns the usedSort.NullHandling
hint, which can but may not be respected by the used datastore.- Returns:
- the used
Sort.NullHandling
hint. - Since:
- 1.7
-
hashCode
public int hashCode() -
equals
-
toString
-