org.springframework.data.relational.core.sql

## Class OrderByField

- java.lang.Object
- - org.springframework.data.relational.core.sql.OrderByField

All Implemented Interfaces:
  Segment, Visitable

    public class OrderByField
    extends Object

Represents a field in the `ORDER BY` clause.

Since:
  1.1
Author:
  Mark Paluch, Milan Milanov

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`OrderByField` `asc()` Creates a new `OrderByField` from a the current one using ascending sorting.
`OrderByField` `desc()` Creates a new `OrderByField` from a the current one using descending sorting.
`boolean` `equals(Object obj)` Check whether this `Segment` is equal to another `Segment`.
`static OrderByField` `from(Column column)` Creates a new `OrderByField` from a `Column` applying default ordering.
`static OrderByField` `from(Column column, Sort.Direction direction)` Creates a new `OrderByField` from a `Column` applying a given ordering.
`Sort.Direction` `getDirection()`
`Expression` `getExpression()`
`Sort.NullHandling` `getNullHandling()`
`int` `hashCode()` Generate a hash code from this`Segment`.
`String` `toString()` Return a SQL string representation of this `Segment`.
`void` `visit(Visitor visitor)` Accept a `Visitor` visiting this `Visitable` and its nested `Visitable`s if applicable.
`OrderByField` `withNullHandling(Sort.NullHandling nullHandling)` Creates a new `OrderByField` with `Sort.NullHandling` applied.

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

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

### Method Detail

#### from

    public static OrderByField from(Column column)

Creates a new `OrderByField` from a `Column` applying default ordering.

Parameters:
  `column` - must not be null.
Returns:
  the `OrderByField`.

#### from

    public static OrderByField from(Column column,
                                    Sort.Direction direction)

Creates a new `OrderByField` from a `Column` applying a given ordering.

Parameters:
  `column` - must not be null.
  `direction` - order direction
Returns:
  the `OrderByField`.

#### asc

    public OrderByField asc()

Creates a new `OrderByField` from a the current one using ascending sorting.

Returns:
  the new `OrderByField` with ascending sorting.
See Also:
  `desc()`

#### desc

    public OrderByField desc()

Creates a new `OrderByField` from a the current one using descending sorting.

Returns:
  the new `OrderByField` with descending sorting.
See Also:
  `asc()`

#### withNullHandling

    public OrderByField withNullHandling(Sort.NullHandling nullHandling)

Creates a new `OrderByField` with `Sort.NullHandling` applied.

Parameters:
  `nullHandling` - must not be null.
Returns:
  the new `OrderByField` with `Sort.NullHandling` applied.

#### getExpression

    public Expression getExpression()

#### getDirection

    @Nullable
    public Sort.Direction getDirection()

#### getNullHandling

    public Sort.NullHandling getNullHandling()

#### toString

    public String toString()

Description copied from interface: `Segment`
Return a SQL string representation of this `Segment`.

The representation is intended for debugging purposes and an approximation to the generated SQL. While it might work in the context of a specific dialect, you should not that the `Segment.toString()` representation works across multiple databases.

Specified by:
  `toString` in interface `Segment`
Overrides:
  `toString` in class `Object`
Returns:
  a SQL string representation of this `Segment`.

#### visit

    public void visit(Visitor visitor)

Description copied from interface: `Visitable`
Accept a `Visitor` visiting this `Visitable` and its nested `Visitable`s if applicable.

Specified by:
  `visit` in interface `Visitable`
Parameters:
  `visitor` - the visitor to notify, must not be null.

#### hashCode

    public int hashCode()

Description copied from interface: `Segment`
Generate a hash code from this`Segment`.

Hashcode typically derives from the `Segment.toString()` representation so two `Segment`s yield the same `Segment.hashCode()` if their `Segment.toString()` representation matches.

Specified by:
  `hashCode` in interface `Segment`
Overrides:
  `hashCode` in class `Object`
Returns:
  a hash code value for this object.

#### equals

    public boolean equals(Object obj)

Description copied from interface: `Segment`
Check whether this `Segment` is equal to another `Segment`.

Equality is typically given if the `Segment.toString()` representation matches.

Specified by:
  `equals` in interface `Segment`
Overrides:
  `equals` in class `Object`
Parameters:
  `obj` - the reference object with which to compare.
Returns:
  true if this object is the same as the `other` argument; false otherwise.