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

  • Type Parameters:
    T - the sort order type
    V - the sorting type
    All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    GridSortOrderBuilder, QuerySortOrderBuilder

    public abstract class SortOrderBuilder<T extends SortOrder<V>,​V>
    extends java.lang.Object
    implements java.io.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:
    8.0
    See Also:
    thenAsc(Object), thenDesc(Object), build(), Serialized Form
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<T> build()
      Returns an unmodifiable copy of the list of current sort orders in this sort builder.
      protected abstract T createSortOrder​(V by, com.vaadin.shared.data.sort.SortDirection direction)
      Creates a sort order object with the given parameters.
      SortOrderBuilder<T,​V> thenAsc​(V by)
      Appends sorting with ascending sort direction.
      SortOrderBuilder<T,​V> thenDesc​(V by)
      Appends sorting with descending sort direction.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SortOrderBuilder

        public SortOrderBuilder()
    • Method Detail

      • 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 java.util.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,
                                             com.vaadin.shared.data.sort.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