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

public Class SimpleSelectClauseStateObject

extends AbstractSelectClauseStateObject
Class Inheritance
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.parser.SimpleSelectClause, .SimpleSelectExpressionBNF, org.eclipse.persistence.jpa.jpql.tools.model.ISimpleSelectExpressionStateObjectBuilder

The SELECT statement queries data from entities. This version simply does not handle OBJECT and NEW identifiers. It is used from within another expression.

BNF: simple_select_clause ::= SELECT [DISTINCT] simple_select_expression

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
SimpleSelectClause

Field Summary

Modifier and TypeField and Description
private ISimpleSelectExpressionStateObjectBuilder
builder

The builder is cached during the creation of the select expression.

public static final String
SELECT_ITEM_PROPERTY

Notifies the select expression property has changed.

private StateObject
stateObject

The state object representing the single select expression.

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject:
DISTINCT_PROPERTY

Constructor Summary

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

Creates a new SubQuerySelectClauseStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
protected void
addChildren(List<StateObject>
The list used to store the children
children
)

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

Adds the children of this StateObject to the given list.
public ISimpleSelectExpressionStateObjectBuilder

Returns:

A new builder that can be used to quickly create a select expression
getBuilder
()

Creates and returns a new ISimpleSelectExpressionStateObjectBuilder that can be used to programmatically create a single select expression and once the expression is complete, ISimpleSelectExpressionStateObjectBuilder#commit() will push the StateObject representation of that expression as this clause's select expression.

public SimpleSelectClause
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.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 SimpleFromClauseStateObject
public SimpleSelectStatementStateObject
public StateObject
getSelectItem()

Returns

public boolean
hasSelectItem()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.hasSelectItem.

Determines whether this SELECT clause has a select item defined (only one can be set for a subquery's SELECT clause and many for a top-level query).
public boolean
isEquivalent(StateObject
The StateObject to compare its content to this one
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.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.
public void
parse(String
The portion of the query representing one or several select items
jpqlFragment
)

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.parse.

Parses the given JPQL fragment and create the select item.
public void
setExpression(SimpleSelectClause
The parsed object representing a subquery SELECT 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.

public void
setSelectItem(StateObject
The StateObject representing the single select item
stateObject
)

Sets the given StateObject as this clause's select item.

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.AbstractSelectClauseStateObject:
hasDistinctsetDistincttoggleDistinct

Field Detail

builderback to summary
private ISimpleSelectExpressionStateObjectBuilder builder

The builder is cached during the creation of the select expression.

SELECT_ITEM_PROPERTYback to summary
public static final String SELECT_ITEM_PROPERTY

Notifies the select expression property has changed.

stateObjectback to summary
private StateObject stateObject

The state object representing the single select expression.

Constructor Detail

SimpleSelectClauseStateObjectback to summary
public SimpleSelectClauseStateObject(SimpleSelectStatementStateObject parent)

Creates a new SubQuerySelectClauseStateObject.

Parameters
parent:SimpleSelectStatementStateObject

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
addChildrenback to summary
protected void addChildren(List<StateObject> children)

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

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

Adds the children of this StateObject to the given list.

Parameters
children:List<StateObject>

The list used to store the children

Annotations
@Override
getBuilderback to summary
public ISimpleSelectExpressionStateObjectBuilder getBuilder()

Creates and returns a new ISimpleSelectExpressionStateObjectBuilder that can be used to programmatically create a single select expression and once the expression is complete, ISimpleSelectExpressionStateObjectBuilder#commit() will push the StateObject representation of that expression as this clause's select expression.

Returns:ISimpleSelectExpressionStateObjectBuilder

A new builder that can be used to quickly create a select expression

getExpressionback to summary
public SimpleSelectClause getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.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:SimpleSelectClause

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
getFromClauseback to summary
public SimpleFromClauseStateObject getFromClause()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.getFromClause.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.getFromClause.

Returns the AbstractFromClauseStateObject representing the FROM clause.

Returns:SimpleFromClauseStateObject

The state object representing the FROM clause

Annotations
@Override
getParentback to summary
public SimpleSelectStatementStateObject getParent()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.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:SimpleSelectStatementStateObject

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

Annotations
@Override
getSelectItemback to summary
public StateObject getSelectItem()

Returns

hasSelectItemback to summary
public boolean hasSelectItem()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.hasSelectItem.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.hasSelectItem.

Determines whether this SELECT clause has a select item defined (only one can be set for a subquery's SELECT clause and many for a top-level query).

Returns:boolean

true if this state object has children; false otherwise

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

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.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
parseback to summary
public void parse(String jpqlFragment)

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.parse.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectClauseStateObject.parse.

Parses the given JPQL fragment and create the select item. For the top-level query, the fragment can contain several select items but for a subquery, it can represent only one.

Parameters
jpqlFragment:String

The portion of the query representing one or several select items

Annotations
@Override
setExpressionback to summary
public void setExpression(SimpleSelectClause 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:SimpleSelectClause

The parsed object representing a subquery SELECT clause

setSelectItemback to summary
public void setSelectItem(StateObject stateObject)

Sets the given StateObject as this clause's select item.

Parameters
stateObject:StateObject

The StateObject representing the single select item

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