public class SortItem
extends java.lang.Object
Encapsulates an OData sort item. A sort item indicates a property (or expression) that is used in the $orderby system query option.
Constructor and Description |
---|
SortItem() |
Modifier and Type | Method and Description |
---|---|
SortOrder |
getOrder()
Return sort order, which defaults to SortOrder.ascending.
|
DataPath |
getPath()
Return (nullable) Obsolete.
|
QueryValue |
getValue()
Return an expression that, when evaluated, will be used for query result ordering.
|
static SortItem |
of(QueryValue value)
Return a new sort item for the specified value.
|
void |
setOrder(SortOrder value)
Set sort order, which defaults to SortOrder.ascending.
|
void |
setValue(QueryValue value)
Set an expression that, when evaluated, will be used for query result ordering.
|
Property |
toProperty()
If this sort item directly references a property, then return the property.
|
Property |
toRequiredProperty()
If this sort item references a simple property path, then return the property.
|
java.lang.String |
toString()
Return a string representation of this sort item.
|
public SortOrder getOrder()
Return sort order, which defaults to SortOrder.ascending.
public DataPath getPath()
Return (nullable) Obsolete. Use SortItem.value
.
SortItem.value
.public QueryValue getValue()
Return an expression that, when evaluated, will be used for query result ordering.
public static SortItem of(QueryValue value)
Return a new sort item for the specified value.
value
- Value for result ordering.public void setOrder(SortOrder value)
Set sort order, which defaults to SortOrder.ascending.
value
- Sort order, which defaults to SortOrder.ascending.public void setValue(QueryValue value)
Set an expression that, when evaluated, will be used for query result ordering.
value
- An expression that, when evaluated, will be used for query result ordering.public Property toProperty()
If this sort item directly references a property, then return the property. Otherwise return null
.
null
.public Property toRequiredProperty()
If this sort item references a simple property path, then return the property. Otherwise throw an exception.
UndefinedException
if this sort item does not reference a simple property path.
public java.lang.String toString()
Return a string representation of this sort item.
toString
in class java.lang.Object