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
- 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, 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 aSort.Order
withSort.NullHandling.NULLS_FIRST
as null handling hint.Returns aSort.Order
withSort.NullHandling.NULLS_LAST
as null handling hint.Returns aSort.Order
withSort.NullHandling.NATIVE
as null handling hint.toString()
with
(Sort.Direction direction) Returns a newSort.Order
with the givenSort.Direction
.with
(Sort.NullHandling nullHandling) Returns aSort.Order
with the givenSort.NullHandling
.withProperties
(String... properties) Returns a newSort
instance for the given properties.withProperty
(String property) Returns a newSort.Order
-
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.
-
-
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:
-
getProperty
Returns the property to order for.- Returns:
-
isAscending
public boolean isAscending()Returns whether sorting for this property shall be ascending.- Returns:
-
isDescending
public boolean isDescending()Returns whether sorting for this property shall be descending.- Returns:
- Since:
- 1.13
-
isIgnoreCase
public boolean isIgnoreCase()Returns whether the sort will be case-sensitive or case-insensitive.- Returns:
-
with
Returns a newSort.Order
with the givenSort.Direction
.- Parameters:
direction
-- Returns:
-
withProperty
Returns a newSort.Order
- Parameters:
property
- must not be null or empty.- Returns:
- Since:
- 1.13
-
withProperties
Returns a newSort
instance for the given properties.- Parameters:
properties
-- Returns:
-
ignoreCase
Returns a newSort.Order
with case insensitive sorting enabled.- Returns:
-
with
Returns aSort.Order
with the givenSort.NullHandling
.- Parameters:
nullHandling
- can be null.- Returns:
- Since:
- 1.8
-
nullsFirst
Returns aSort.Order
withSort.NullHandling.NULLS_FIRST
as null handling hint.- Returns:
- Since:
- 1.8
-
nullsLast
Returns aSort.Order
withSort.NullHandling.NULLS_LAST
as null handling hint.- Returns:
- Since:
- 1.7
-
nullsNative
Returns aSort.Order
withSort.NullHandling.NATIVE
as null handling hint.- Returns:
- Since:
- 1.7
-
getNullHandling
Returns the usedSort.NullHandling
hint, which can but may not be respected by the used datastore.- Returns:
- Since:
- 1.7
-
hashCode
public int hashCode() -
equals
-
toString
-