Package io.ebean

Class OrderBy<T>

  • All Implemented Interfaces:

    public final class OrderBy<T>
    extends Object
    implements Serializable
    Represents an Order By for a Query.

    Is a ordered list of OrderBy.Property objects each specifying a property and whether it is ascending or descending order.

    Typically you will not construct an OrderBy yourself but use one that exists on the Query object.

    See Also:
    Serialized Form
    • Constructor Detail

      • OrderBy

        public OrderBy()
        Create an empty OrderBy with no associated query.
      • OrderBy

        public OrderBy​(String orderByClause)
        Create an orderBy parsing the order by clause.

        The order by clause follows SQL order by clause with comma's between each property and optionally "asc" or "desc" to represent ascending or descending order respectively.

      • OrderBy

        public OrderBy​(Query<T> query,
                       String orderByClause)
        Construct with a given query and order by clause.
    • Method Detail

      • reverse

        public void reverse()
        Reverse the ascending/descending order on all the properties.
      • asc

        public Query<Tasc​(String propertyName)
        Add a property with ascending order to this OrderBy.
      • asc

        public Query<Tasc​(String propertyName,
                            String collation)
        Add a property with ascending order to this OrderBy.
      • desc

        public Query<Tdesc​(String propertyName)
        Add a property with descending order to this OrderBy.
      • desc

        public Query<Tdesc​(String propertyName,
                             String collation)
        Add a property with descending order to this OrderBy.
      • containsProperty

        public boolean containsProperty​(String propertyName)
        Return true if the property is known to be contained in the order by clause.
      • isEmpty

        public boolean isEmpty()
        Return true if this OrderBy does not have any properties.
      • getQuery

        public Query<TgetQuery()
        Return the associated query if there is one.
      • setQuery

        public void setQuery​(Query<T> query)
        Associate this OrderBy with a query.
      • copy

        public OrderBy<Tcopy()
        Return a copy of the OrderBy.
      • add

        public void add​(String rawExpression)
        Add to the order by by parsing a raw expression.
      • hashCode

        public int hashCode()
        Return a hash value for this OrderBy. This can be to determine logical equality for OrderBy clauses.
        hashCode in class Object
      • clear

        public OrderBy<Tclear()
        Clear the orderBy removing any current order by properties.

        This is intended to be used when some code creates a query with a 'default' order by clause and some other code may clear the 'default' order by clause and replace.

      • supportsSelect

        public boolean supportsSelect()
        Return true if this order by can be used in select clause.