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
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, boolean ignoreCase, Sort.NullHandling nullHandling) 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 a newSort.OrderwithSort.NullHandling.NULLS_FIRSTas null handling hint applied.Returns a newSort.OrderwithSort.NullHandling.NULLS_LASTas null handling hint applied.Returns a newSort.OrderwithSort.NullHandling.NATIVEas null handling hint applied.reverse()Returns a newSort.Orderwith the reversedgetDirection()applied.toString()with(Sort.Direction direction) Returns a newSort.Orderwith the givenSort.Directionapplied.with(Sort.NullHandling nullHandling) Returns aSort.Orderwith the givenSort.NullHandlingapplied.withProperties(String... properties) Returns a newSortinstance for the given properties usinggetDirection().withProperty(String property) Returns a newSort.Orderwith thepropertyname applied.
-
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.
-
Order
public Order(@Nullable Sort.Direction direction, String property, boolean ignoreCase, Sort.NullHandling nullHandling) 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.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.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:
- 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.Orderwith the givenSort.Directionapplied.- Parameters:
direction- the new direction to use.- Returns:
- a new
Sort.Orderwith the givenSort.Directionapplied.
-
reverse
Returns a newSort.Orderwith the reversedgetDirection()applied.- Returns:
- a reversed
Sort.Orderwith the givenSort.Directionapplied. - Since:
- 3.1
-
withProperty
Returns a newSort.Orderwith thepropertyname applied.- Parameters:
property- must not be null or empty.- Returns:
- a new
Sort.Orderwith thepropertyname applied. - Since:
- 1.13
-
withProperties
Returns a newSortinstance for the given properties usinggetDirection().- Parameters:
properties- properties to sort by.- Returns:
- a new
Sortinstance for the given properties usinggetDirection().
-
ignoreCase
Returns a newSort.Orderwith case-insensitive sorting enabled.- Returns:
- a new
Sort.Orderwith case-insensitive sorting enabled.
-
with
Returns aSort.Orderwith the givenSort.NullHandlingapplied.- Parameters:
nullHandling- can be null.- Returns:
- a new
Sort.Orderwith the givenSort.NullHandlingapplied. - Since:
- 1.8
-
nullsFirst
Returns a newSort.OrderwithSort.NullHandling.NULLS_FIRSTas null handling hint applied.- Returns:
- a new
Sort.OrderwithSort.NullHandling.NULLS_FIRSTas null handling hint applied. - Since:
- 1.8
-
nullsLast
Returns a newSort.OrderwithSort.NullHandling.NULLS_LASTas null handling hint applied.- Returns:
- a new
Sort.OrderwithSort.NullHandling.NULLS_LASTas null handling hint applied. - Since:
- 1.7
-
nullsNative
Returns a newSort.OrderwithSort.NullHandling.NATIVEas null handling hint applied.- Returns:
- a new
Sort.OrderwithSort.NullHandling.NATIVEas null handling hint applied. - Since:
- 1.7
-
getNullHandling
Returns the usedSort.NullHandlinghint, which can but may not be respected by the used datastore.- Returns:
- the used
Sort.NullHandlinghint. - Since:
- 1.7
-
hashCode
public int hashCode() -
equals
-
toString
-