Class SortOrderBuilder<T extends SortOrder<V>,V>

java.lang.Object
com.vaadin.flow.data.provider.SortOrderBuilder<T,V>
Type Parameters:
T - the sort order type
V - the sorting type
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
GridSortOrderBuilder, QuerySortOrderBuilder

public abstract class SortOrderBuilder<T extends SortOrder<V>,V> extends Object implements Serializable
Base class for helper classes with fluent API for constructing sort order lists. When the sort order is ready to be passed on, calling build() will create the list of sort orders.
Since:
1.0
See Also:
  • Constructor Details

    • SortOrderBuilder

      public SortOrderBuilder()
  • Method Details

    • thenAsc

      public SortOrderBuilder<T,V> thenAsc(V by)
      Appends sorting with ascending sort direction.
      Parameters:
      by - the object to sort by
      Returns:
      this sort builder
    • thenDesc

      public SortOrderBuilder<T,V> thenDesc(V by)
      Appends sorting with descending sort direction.
      Parameters:
      by - the object to sort by
      Returns:
      this sort builder
    • build

      public final List<T> build()
      Returns an unmodifiable copy of the list of current sort orders in this sort builder.
      Returns:
      an unmodifiable sort order list
    • createSortOrder

      protected abstract T createSortOrder(V by, SortDirection direction)
      Creates a sort order object with the given parameters.
      Parameters:
      by - the object to sort by
      direction - the sort direction
      Returns:
      the sort order object