Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools.model.query

public Class GroupByClauseStateObject

extends AbstractListHolderStateObject<StateObject>
Class Inheritance
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.parser.GroupByClause, .GroupByItemBNF

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}*

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
GroupByClause

Field Summary

Modifier and TypeField and Description
public static final String
GROUP_BY_ITEMS_LIST

Notify the list of StateObjects representing the GROUP BY items.

Constructor Summary

AccessConstructor and Description
public
GroupByClauseStateObject(AbstractSelectStatementStateObject
The parent of this state object, which cannot be null
parent
)

Creates a new GroupByClauseStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
public StateObject

Returns:

The StateObject encapsulating the given path
addGroupByItem
(String
Either an identification variable or a state-field path expression
path
)

Adds the given path as a select item, which can either be an identification variable or a state-field path expression.

public GroupByClause
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.
public AbstractSelectStatementStateObject
public boolean
isEquivalent(StateObject
The StateObject to compare its content to this one
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.
protected String
listName()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject.listName.

Returns the name that is uniquely identifying the list.
public void
parse(String
The string representation of the group by items
jpqlFragment
)

Parses the given JPQL fragment, which will represent the group by items.

public void
setExpression(GroupByClause
The parsed object representing a GROUP BY clause
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(Appendable
The writer used to print out the string representation
writer
)

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

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.
Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject:
addChildrenaddItemaddItemsaddListChangeListenerareChildrenEquivalentcanMoveDowncanMoveUpgetItemhasItemsinitializeitemsitemsSizemoveDownmoveUpremoveItemremoveItemsremoveListChangeListenertoStringItems

Field Detail

GROUP_BY_ITEMS_LISTback to summary
public static final String GROUP_BY_ITEMS_LIST

Notify the list of StateObjects representing the GROUP BY items.

Constructor Detail

GroupByClauseStateObjectback to summary
public GroupByClauseStateObject(AbstractSelectStatementStateObject parent)

Creates a new GroupByClauseStateObject.

Parameters
parent:AbstractSelectStatementStateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

acceptback to summary
public void accept(StateObjectVisitor visitor)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.accept.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.accept.

Visits this StateObject by the given visitor.

Parameters
visitor:StateObjectVisitor

The visitor to visit this object

Annotations
@Override
addGroupByItemback to summary
public StateObject addGroupByItem(String path)

Adds the given path as a select item, which can either be an identification variable or a state-field path expression.

Parameters
path:String

Either an identification variable or a state-field path expression

Returns:StateObject

The StateObject encapsulating the given path

getExpressionback to summary
public GroupByClause getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

Returns:GroupByClause

The parsed object when a JPQL query is parsed and converted into a StateObject or null when the JPQL query is manually created (i.e. not from a string)

Annotations
@Override
getParentback to summary
public AbstractSelectStatementStateObject getParent()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getParent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getParent.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getParent.

Returns the parent of this StateObject.

Returns:AbstractSelectStatementStateObject

Returns the parent of this StateObject, which is null only when this is the root of the hierarchy

Annotations
@Override
isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

Parameters
stateObject:StateObject

The StateObject to compare its content to this one

Returns:boolean

true if both object are equivalent; false otherwise

Annotations
@Override
listNameback to summary
protected String listName()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject.listName.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject.listName.

Returns the name that is uniquely identifying the list.

Returns:String

The unique name identifying the list

Annotations
@Override
parseback to summary
public void parse(String jpqlFragment)

Parses the given JPQL fragment, which will represent the group by items. The fragment cannot start with the GROUP BY.

Parameters
jpqlFragment:String

The string representation of the group by items

setExpressionback to summary
public void setExpression(GroupByClause 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.

Parameters
expression:GroupByClause

The parsed object representing a GROUP BY clause

toTextInternalback to summary
protected void toTextInternal(Appendable writer) throws IOException

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

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.

Parameters
writer:Appendable

The writer used to print out the string representation

Annotations
@Override
Exceptions
IOException:
This should never happens, it is only required because Appendable is used instead of any concrete class