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
ConstructorsConstructorDescriptionOrder(Sort.Direction direction, String property) Creates a newSort.Orderinstance. if order is null then order defaults toSort.DEFAULT_DIRECTIONOrder(Sort.Direction direction, String property, Sort.NullHandling nullHandlingHint) Creates a newSort.Orderinstance. if order is null then order defaults toSort.DEFAULT_DIRECTION -
Method Summary
Modifier and TypeMethodDescriptionstatic Sort.OrderCreates a newSort.Orderinstance.static Sort.OrderCreates a newSort.Orderinstance.static Sort.OrderCreates a newSort.Orderinstance.booleanReturns the order the property shall be sorted for.Returns the usedSort.NullHandlinghint, which can but may not be respected by the used datastore.Returns the property to order for.inthashCode()Returns a newSort.Orderwith case insensitive sorting enabled.booleanReturns whether sorting for this property shall be ascending.booleanReturns whether sorting for this property shall be descending.booleanReturns whether the sort will be case-sensitive or case-insensitive.Returns aSort.OrderwithSort.NullHandling.NULLS_FIRSTas null handling hint.Returns aSort.OrderwithSort.NullHandling.NULLS_LASTas null handling hint.Returns aSort.OrderwithSort.NullHandling.NATIVEas null handling hint.toString()with(Sort.Direction direction) Returns a newSort.Orderwith the givenSort.Direction.with(Sort.NullHandling nullHandling) Returns aSort.Orderwith the givenSort.NullHandling.withProperties(String... properties) Returns a newSortinstance for the given properties.withProperty(String property) Returns a newSort.Order
-
Constructor Details
-
Order
Creates a newSort.Orderinstance. if order is null then order defaults toSort.DEFAULT_DIRECTION- Parameters:
direction- can be null, will default toSort.DEFAULT_DIRECTIONproperty- must not be null or empty.
-
Order
public Order(@Nullable Sort.Direction direction, String property, Sort.NullHandling nullHandlingHint) Creates a newSort.Orderinstance. if order is null then order defaults toSort.DEFAULT_DIRECTION- Parameters:
direction- can be null, will default toSort.DEFAULT_DIRECTIONproperty- must not be null or empty.nullHandlingHint- must not be null.
-
-
Method Details
-
by
Creates a newSort.Orderinstance. Takes a single property. Direction defaults toSort.DEFAULT_DIRECTION.- Parameters:
property- must not be null or empty.- Since:
- 2.0
-
asc
Creates a newSort.Orderinstance. Takes a single property. Direction isSort.Direction.ASCand NullHandlingSort.NullHandling.NATIVE.- Parameters:
property- must not be null or empty.- Since:
- 2.0
-
desc
Creates a newSort.Orderinstance. Takes a single property. Direction isSort.Direction.DESCand 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.Orderwith 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 newSortinstance for the given properties.- Parameters:
properties-- Returns:
-
ignoreCase
Returns a newSort.Orderwith case insensitive sorting enabled.- Returns:
-
with
Returns aSort.Orderwith the givenSort.NullHandling.- Parameters:
nullHandling- can be null.- Returns:
- Since:
- 1.8
-
nullsFirst
Returns aSort.OrderwithSort.NullHandling.NULLS_FIRSTas null handling hint.- Returns:
- Since:
- 1.8
-
nullsLast
Returns aSort.OrderwithSort.NullHandling.NULLS_LASTas null handling hint.- Returns:
- Since:
- 1.7
-
nullsNative
Returns aSort.OrderwithSort.NullHandling.NATIVEas null handling hint.- Returns:
- Since:
- 1.7
-
getNullHandling
Returns the usedSort.NullHandlinghint, which can but may not be respected by the used datastore.- Returns:
- Since:
- 1.7
-
hashCode
public int hashCode() -
equals
-
toString
-