Module org.jooq
Package org.jooq

Interface SortField<T>

Type Parameters:
T - The field type
All Superinterfaces:
OrderField<T>, QueryPart, Serializable

public non-sealed interface SortField<T> extends OrderField<T>
A sort specification.

The SQL ORDER BY clause accepts expressions based on Field, which may be enhanced by ASC or DESC as well as NULLS FIRST or NULLS LAST.

Example:


 // Assuming import static org.jooq.impl.DSL.*;

 using(configuration)
    .select(ACTOR.FIRST_NAME, ACTOR.LAST_NAME)
    .from(ACTOR)
    .orderBy(ACTOR.LAST_UPDATE.desc().nullsLast())
    .fetch();
 

Instances can be created using Field.asc(), Field.desc() and related methods.

Author:
Lukas Eder
See Also:
  • Method Details

    • getName

      @NotNull @NotNull String getName()
      The name of this sort field
    • getOrder

      @NotNull @NotNull SortOrder getOrder()
      Get the underlying sort order of this sort field
    • nullsFirst

      @NotNull @Support @NotNull SortField<T> nullsFirst()
      Add a NULLS FIRST clause to this sort field
    • nullsLast

      @NotNull @Support @NotNull SortField<T> nullsLast()
      Add a NULLS LAST clause to this sort field
    • $field

      @Experimental @NotNull @NotNull Field<T> $field()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $field

      @Experimental @NotNull <U> @NotNull SortField<U> $field(Field<U> newField)
      Experimental query object model mutator method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $sortOrder

      @Experimental @NotNull @NotNull SortOrder $sortOrder()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $sortOrder

      @Experimental @NotNull @NotNull SortField<T> $sortOrder(SortOrder newOrder)
      Experimental query object model mutator method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $nullOrdering

      @Experimental @Nullable @Nullable QOM.NullOrdering $nullOrdering()
      Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.
    • $nullOrdering

      @Experimental @NotNull @NotNull SortField<T> $nullOrdering(QOM.NullOrdering newOrdering)
      Experimental query object model mutator method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.