Package io.ebean
Class OrderBy<T>
- java.lang.Object
-
- io.ebean.OrderBy<T>
-
- All Implemented Interfaces:
Serializable
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OrderBy.Property
A property and its ascending descending order.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(OrderBy.Property p)
Add a property to the order by.void
add(String rawExpression)
Add to the order by by parsing a raw expression.Query<T>
asc(String propertyName)
Add a property with ascending order to this OrderBy.Query<T>
asc(String propertyName, String collation)
Add a property with ascending order to this OrderBy.OrderBy<T>
clear()
Clear the orderBy removing any current order by properties.boolean
containsProperty(String propertyName)
Return true if the property is known to be contained in the order by clause.OrderBy<T>
copy()
Return a copy of the OrderBy.OrderBy<T>
copyWithTrim(String path)
Return a copy of this OrderBy with the path trimmed.Query<T>
desc(String propertyName)
Add a property with descending order to this OrderBy.Query<T>
desc(String propertyName, String collation)
Add a property with descending order to this OrderBy.boolean
equals(Object obj)
List<OrderBy.Property>
getProperties()
Return the properties for this OrderBy.Query<T>
getQuery()
Return the associated query if there is one.int
hashCode()
Return a hash value for this OrderBy.boolean
isEmpty()
Return true if this OrderBy does not have any properties.void
reverse()
Reverse the ascending/descending order on all the properties.void
setQuery(Query<T> query)
Associate this OrderBy with a query.boolean
supportsSelect()
Return true if this order by can be used in select clause.String
toString()
String
toStringFormat()
Returns the OrderBy in string format.
-
-
-
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.
-
-
Method Detail
-
reverse
public void reverse()
Reverse the ascending/descending order on all the properties.
-
asc
public Query<T> asc(String propertyName, String collation)
Add a property with ascending order to this OrderBy.
-
desc
public Query<T> desc(String propertyName)
Add a property with descending order to this OrderBy.
-
desc
public Query<T> desc(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.
-
copyWithTrim
public OrderBy<T> copyWithTrim(String path)
Return a copy of this OrderBy with the path trimmed.
-
getProperties
public List<OrderBy.Property> getProperties()
Return the properties for this OrderBy.
-
isEmpty
public boolean isEmpty()
Return true if this OrderBy does not have any properties.
-
add
public void add(OrderBy.Property p)
Add a property to the order by.
-
toStringFormat
public String toStringFormat()
Returns the OrderBy in string format.
-
hashCode
public int hashCode()
Return a hash value for this OrderBy. This can be to determine logical equality for OrderBy clauses.
-
clear
public OrderBy<T> clear()
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.
-
-