public interface Order
Order encapsulates the semantics of a result set sorting. Any given
time, objects of this class can exist in one of two modes: building
or built. When an Order is built, it is guaranteed to
represent a fully and well formed sort order that can be processed. On the
other hand, when a Order is building it is in an incomplete state.
This class is the public interface to Order construction. It is meant to
be used in a chained manner, where the caller initially calls
by(java.lang.String) and continues to construct the Order using the
options available from each subsequently returned state.
| Modifier and Type | Method and Description |
|---|---|
static OrderByState |
by(String key)
Start building a new
Order. |
static Order |
from(OrderTree tree)
Return an
Order based on the parsed statement that produced the
OrderTree. |
default Set<String> |
keys()
Return all the keys that are referenced by this
Order. |
default Map<String,Collection<Timestamp>> |
keysWithTimestamps()
|
static Order |
none()
Return an
Order that specifies no order. |
List<OrderComponent> |
spec()
Return the order specification, expressed as an ordered list of
components containing each key, an optional
Timestamp and the the corresponding direction ordinal (e.g. |
static OrderByState by(String key)
Order.static Order from(OrderTree tree)
Order based on the parsed statement that produced the
OrderTree.tree - Orderdefault Map<String,Collection<Timestamp>> keysWithTimestamps()
keys() referenced by this Order that
have a Timestamp as a mapping from the key to a collection of all
of its associated timestamps.List<OrderComponent> spec()
components containing each key, an optional
Timestamp and the the corresponding direction ordinal (e.g. 1 for
ASC and -1 for DESC) in the constructed Order.OrderComponents that form
this Order.