Class GroupByClauseStateObject
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject<StateObject>
org.eclipse.persistence.jpa.jpql.tools.model.query.GroupByClauseStateObject
- All Implemented Interfaces:
ListHolderStateObject<StateObject>
,StateObject
The
GROUP BY
construct enables the aggregation of values according to the
properties of an entity class.
BNF: groupby_clause ::= GROUP BY groupby_item {, groupby_item}*
- Since:
- 2.4
- Version:
- 2.4
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Notify the list ofStateObjects
representing theGROUP BY
items. -
Constructor Summary
ConstructorDescriptionCreates a newGroupByClauseStateObject
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(StateObjectVisitor visitor) Visits thisStateObject
by the givenvisitor
.addGroupByItem
(String path) Adds the given path as a select item, which can either be an identification variable or a state-field path expression.Returns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.Returns the parent of thisStateObject
.boolean
isEquivalent
(StateObject stateObject) Determines whether the givenStateObject
is equivalent to this one, i.e.protected String
listName()
Returns the name that is uniquely identifying the list.void
Parses the given JPQL fragment, which will represent the group by items.void
setExpression
(GroupByClause expression) Keeps a reference of theparsed object
object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects
.protected void
toTextInternal
(Appendable writer) Prints out a string representation of thisStateObject
, which should not be used to define atrue
string representation of a JPQL query but should be used for debugging purposes.Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject
addChildren, addItem, addItems, addListChangeListener, areChildrenEquivalent, canMoveDown, canMoveUp, getItem, hasItems, initialize, items, itemsSize, moveDown, moveUp, removeItem, removeItems, removeListChangeListener, toStringItems
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
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
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
addPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
-
Field Details
-
GROUP_BY_ITEMS_LIST
Notify the list ofStateObjects
representing theGROUP BY
items.- See Also:
-
-
Constructor Details
-
GroupByClauseStateObject
Creates a newGroupByClauseStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
NullPointerException
- The given parent cannot benull
-
-
Method Details
-
accept
Description copied from interface:StateObject
Visits thisStateObject
by the givenvisitor
.- Parameters:
visitor
- Thevisitor
to visit this object
-
addGroupByItem
Adds the given path as a select item, which can either be an identification variable or a state-field path expression.- Parameters:
path
- Either an identification variable or a state-field path expression- Returns:
- The
StateObject
encapsulating the given path
-
getExpression
Description copied from interface:StateObject
Returns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.- Specified by:
getExpression
in interfaceStateObject
- Overrides:
getExpression
in classAbstractStateObject
- Returns:
- The parsed object when a JPQL query is parsed and converted into a
StateObject
ornull
when the JPQL query is manually created (i.e. not from a string)
-
getParent
Description copied from interface:StateObject
Returns the parent of thisStateObject
.- Specified by:
getParent
in interfaceStateObject
- Overrides:
getParent
in classAbstractStateObject
- Returns:
- Returns the parent of this
StateObject
, which isnull
only when this is the root of the hierarchy
-
isEquivalent
Description copied from interface:StateObject
Determines whether the givenStateObject
is equivalent to this one, i.e. the information of bothStateObject
is the same.- Specified by:
isEquivalent
in interfaceStateObject
- Overrides:
isEquivalent
in classAbstractStateObject
- Parameters:
stateObject
- TheStateObject
to compare its content to this one- Returns:
true
if both object are equivalent;false
otherwise
-
listName
Description copied from class:AbstractListHolderStateObject
Returns the name that is uniquely identifying the list.- Specified by:
listName
in classAbstractListHolderStateObject<StateObject>
- Returns:
- The unique name identifying the list
-
parse
Parses the given JPQL fragment, which will represent the group by items. The fragment cannot start with theGROUP BY
.- Parameters:
jpqlFragment
- The string representation of the group by items
-
setExpression
Keeps a reference of theparsed object
object, which should only be done when this object is instantiated during the conversion of a parsed JPQL query intoStateObjects
.- Parameters:
expression
- Theparsed object
representing aGROUP BY
clause
-
toTextInternal
Description copied from class:AbstractStateObject
Prints out a string representation of thisStateObject
, which should not be used to define atrue
string representation of a JPQL query but should be used for debugging purposes.- Specified by:
toTextInternal
in classAbstractStateObject
- Parameters:
writer
- The writer used to print out the string representation- Throws:
IOException
- This should never happens, it is only required becauseAppendable
is used instead of any concrete class
-