org.springframework.data.domain

## Class Sort.Order

- java.lang.Object
- - org.springframework.data.domain.Sort.Order

All Implemented Interfaces:
  Serializable

Enclosing class:
  Sort

    public static class Sort.Order
    extends Object
    implements Serializable

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:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`Order(Sort.Direction direction, String property)` Creates a new `Sort.Order` instance. if order is null then order defaults to `Sort.DEFAULT_DIRECTION`
`Order(Sort.Direction direction, String property, Sort.NullHandling nullHandlingHint)` Creates a new `Sort.Order` instance. if order is null then order defaults to `Sort.DEFAULT_DIRECTION`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static Sort.Order` `asc(String property)` Creates a new `Sort.Order` instance.
`static Sort.Order` `by(String property)` Creates a new `Sort.Order` instance.
`static Sort.Order` `desc(String property)` Creates a new `Sort.Order` instance.
`boolean` `equals(Object obj)`
`Sort.Direction` `getDirection()` Returns the order the property shall be sorted for.
`Sort.NullHandling` `getNullHandling()` Returns the used `Sort.NullHandling` hint, which can but may not be respected by the used datastore.
`String` `getProperty()` Returns the property to order for.
`int` `hashCode()`
`Sort.Order` `ignoreCase()` Returns a new `Sort.Order` with case insensitive sorting enabled.
`boolean` `isAscending()` Returns whether sorting for this property shall be ascending.
`boolean` `isDescending()` Returns whether sorting for this property shall be descending.
`boolean` `isIgnoreCase()` Returns whether or not the sort will be case sensitive.
`Sort.Order` `nullsFirst()` Returns a `Sort.Order` with `Sort.NullHandling.NULLS_FIRST` as null handling hint.
`Sort.Order` `nullsLast()` Returns a `Sort.Order` with `Sort.NullHandling.NULLS_LAST` as null handling hint.
`Sort.Order` `nullsNative()` Returns a `Sort.Order` with `Sort.NullHandling.NATIVE` as null handling hint.
`String` `toString()`
`Sort.Order` `with(Sort.Direction direction)` Returns a new `Sort.Order` with the given `Sort.Direction`.
`Sort.Order` `with(Sort.NullHandling nullHandling)` Returns a `Sort.Order` with the given `Sort.NullHandling`.
`Sort` `withProperties(String... properties)` Returns a new `Sort` instance for the given properties.
`Sort.Order` `withProperty(String property)` Returns a new `Sort.Order`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Order

    public Order(@Nullable
                 Sort.Direction direction,
                 String property)

Creates a new `Sort.Order` instance. if order is null then order defaults to `Sort.DEFAULT_DIRECTION`

Parameters:
  `direction` - can be null, will default to `Sort.DEFAULT_DIRECTION`
  `property` - must not be null or empty.

#### Order

    public Order(@Nullable
                 Sort.Direction direction,
                 String property,
                 Sort.NullHandling nullHandlingHint)

Creates a new `Sort.Order` instance. if order is null then order defaults to `Sort.DEFAULT_DIRECTION`

Parameters:
  `direction` - can be null, will default to `Sort.DEFAULT_DIRECTION`
  `property` - must not be null or empty.
  `nullHandling` - must not be null.

### Method Detail

#### by

    public static Sort.Order by(String property)

Creates a new `Sort.Order` instance. Takes a single property. Direction defaults to `Sort.DEFAULT_DIRECTION`.

Parameters:
  `property` - must not be null or empty.
Since:
  2.0

#### asc

    public static Sort.Order asc(String property)

Creates a new `Sort.Order` instance. Takes a single property. Direction is `Sort.Direction.ASC` and NullHandling `Sort.NullHandling.NATIVE`.

Parameters:
  `property` - must not be null or empty.
Since:
  2.0

#### desc

    public static Sort.Order desc(String property)

Creates a new `Sort.Order` instance. Takes a single property. Direction is `Sort.Direction.DESC` and NullHandling `Sort.NullHandling.NATIVE`.

Parameters:
  `property` - must not be null or empty.
Since:
  2.0

#### getDirection

    public Sort.Direction getDirection()

Returns the order the property shall be sorted for.

Returns:

#### getProperty

    public String 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 or not the sort will be case sensitive.

Returns:

#### with

    public Sort.Order with(Sort.Direction direction)

Returns a new `Sort.Order` with the given `Sort.Direction`.

Parameters:
  `direction` -
Returns:

#### withProperty

    public Sort.Order withProperty(String property)

Returns a new `Sort.Order`

Parameters:
  `property` - must not be null or empty.
Returns:
Since:
  1.13

#### withProperties

    public Sort withProperties(String... properties)

Returns a new `Sort` instance for the given properties.

Parameters:
  `properties` -
Returns:

#### ignoreCase

    public Sort.Order ignoreCase()

Returns a new `Sort.Order` with case insensitive sorting enabled.

Returns:

#### with

    public Sort.Order with(Sort.NullHandling nullHandling)

Returns a `Sort.Order` with the given `Sort.NullHandling`.

Parameters:
  `nullHandling` - can be null.
Returns:
Since:
  1.8

#### nullsFirst

    public Sort.Order nullsFirst()

Returns a `Sort.Order` with `Sort.NullHandling.NULLS_FIRST` as null handling hint.

Returns:
Since:
  1.8

#### nullsLast

    public Sort.Order nullsLast()

Returns a `Sort.Order` with `Sort.NullHandling.NULLS_LAST` as null handling hint.

Returns:
Since:
  1.7

#### nullsNative

    public Sort.Order nullsNative()

Returns a `Sort.Order` with `Sort.NullHandling.NATIVE` as null handling hint.

Returns:
Since:
  1.7

#### getNullHandling

    public Sort.NullHandling getNullHandling()

Returns the used `Sort.NullHandling` hint, which can but may not be respected by the used datastore.

Returns:
Since:
  1.7

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### equals

    public boolean equals(@Nullable
                          Object obj)

Overrides:
  `equals` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`