public class OrderByClauseStateObject extends AbstractListHolderStateObject<OrderByItemStateObject>
ORDER BY
clause allows the objects or values that are returned by the
query to be ordered.
orderby_clause ::= ORDER BY orderby_item
{, orderby_item
}*
OrderByClause
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ORDER_BY_ITEMS_LIST
Notify the list of
StateObjects representing the ORDER BY
items. |
Constructor and Description |
---|
OrderByClauseStateObject(SelectStatementStateObject parent)
Creates a new
OrderByClauseStateObject . |
Modifier and Type | Method and Description |
---|---|
void |
accept(StateObjectVisitor visitor)
Visits this
StateObject by the given visitor . |
OrderByItemStateObject |
addItem()
Adds a new
ORDER BY item to this clause. |
OrderByItemStateObject |
addItem(OrderByItem.Ordering ordering)
Adds a new
ORDER BY item to this clause. |
OrderByItemStateObject |
addItem(java.lang.String... paths)
Adds a new
ORDER BY item to this clause. |
OrderByItemStateObject |
addItem(java.lang.String variable)
Adds a new
ORDER BY item to this clause. |
OrderByItemStateObject |
addItem(java.lang.String path,
OrderByItem.Ordering ordering)
Adds a new
ORDER BY item to this clause. |
OrderByItemStateObject |
addItemAsc(java.lang.String variable)
Adds a new
ORDER BY item to this clause with ASC . |
OrderByItemStateObject |
addItemDesc(java.lang.String variable)
Adds a new
ORDER BY item to this clause with DESC . |
OrderByItemStateObject |
addOrderByItem(java.lang.String[] paths,
OrderByItem.Ordering ordering)
Adds a new
ORDER BY item to this clause. |
OrderByClause |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
SelectStatementStateObject |
getParent()
Returns the parent of this
StateObject . |
boolean |
isEquivalent(StateObject stateObject)
Determines whether the given
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same. |
protected java.lang.String |
listName()
Returns the name that is uniquely identifying the list.
|
void |
parse(java.lang.String jpqlFragment)
Parses the given JPQL fragment, which represents either a single or many ordering items, the
fragment will be parsed and converted into
OrderByItemStateObject . |
void |
setExpression(OrderByClause expression)
Keeps a reference of the
parsed object object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects . |
protected void |
toTextInternal(java.lang.Appendable writer)
Prints out a string representation of this
StateObject , which should not be used to
define a true string representation of a JPQL query but should be used for
debugging purposes. |
addChildren, addItem, addItems, addListChangeListener, areChildrenEquivalent, canMoveDown, canMoveUp, getItem, hasItems, initialize, items, itemsSize, moveDown, moveUp, removeItem, removeItems, removeListChangeListener, toStringItems
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toText
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
public static final java.lang.String ORDER_BY_ITEMS_LIST
StateObjects
representing the ORDER BY
items.public OrderByClauseStateObject(SelectStatementStateObject parent)
OrderByClauseStateObject
.parent
- The parent of this state object, which cannot be null
java.lang.NullPointerException
- The given parent cannot be null
public void accept(StateObjectVisitor visitor)
StateObject
by the given visitor
.visitor
- The visitor
to visit this objectpublic OrderByItemStateObject addItem()
ORDER BY
item to this clause.OrderByItemStateObject
public OrderByItemStateObject addItem(OrderByItem.Ordering ordering)
ORDER BY
item to this clause.ordering
- The ascending orderOrderByItemStateObject
public OrderByItemStateObject addItem(java.lang.String... paths)
ORDER BY
item to this clause.OrderByItemStateObject
public OrderByItemStateObject addItem(java.lang.String variable)
ORDER BY
item to this clause.variable
- The identification variable or the result variableOrderByItemStateObject
public OrderByItemStateObject addItem(java.lang.String path, OrderByItem.Ordering ordering)
ORDER BY
item to this clause.path
- The identification variable or the result variableordering
- The ascending orderOrderByItemStateObject
public OrderByItemStateObject addItemAsc(java.lang.String variable)
ORDER BY
item to this clause with ASC
.variable
- The identification variable or the result variableOrderByItemStateObject
public OrderByItemStateObject addItemDesc(java.lang.String variable)
ORDER BY
item to this clause with DESC
.variable
- The identification variable or the result variableOrderByItemStateObject
public OrderByItemStateObject addOrderByItem(java.lang.String[] paths, OrderByItem.Ordering ordering)
ORDER BY
item to this clause.paths
- The paths or the itemordering
- The ascending orderOrderByItemStateObject
public OrderByClause getExpression()
StateObject
representation of the JPQL query
was created by parsing an existing JPQL query.getExpression
in interface StateObject
getExpression
in class AbstractStateObject
StateObject
or null
when the JPQL query is manually created (i.e. not from a string)public SelectStatementStateObject getParent()
StateObject
.getParent
in interface StateObject
getParent
in class AbstractStateObject
StateObject
, which is null
only when
this is the root of the hierarchypublic boolean isEquivalent(StateObject stateObject)
StateObject
is equivalent to this one, i.e. the
information of both StateObject
is the same.isEquivalent
in interface StateObject
isEquivalent
in class AbstractStateObject
stateObject
- The StateObject
to compare its content to this onetrue
if both object are equivalent; false
otherwiseprotected java.lang.String listName()
listName
in class AbstractListHolderStateObject<OrderByItemStateObject>
public void parse(java.lang.String jpqlFragment)
OrderByItemStateObject
.jpqlFragment
- The portion of the query to parsepublic void setExpression(OrderByClause expression)
parsed object
object, which should only be
done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects
.expression
- The parsed object
representing an ORDER
BY
protected void toTextInternal(java.lang.Appendable writer) throws java.io.IOException
StateObject
, which should not be used to
define a true
string representation of a JPQL query but should be used for
debugging purposes.toTextInternal
in class AbstractStateObject
writer
- The writer used to print out the string representationjava.io.IOException
- This should never happens, it is only required because Appendable
is used instead of any concrete class