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

public Class SimpleSelectStatementStateObject

extends AbstractSelectStatementStateObject
Class Inheritance
Imports
org.eclipse.persistence.jpa.jpql.parser.SimpleSelectStatement, org.eclipse.persistence.jpa.jpql.tools.model.ISimpleSelectExpressionStateObjectBuilder

This state object represents a subquery, which has at least a SELECT clause and a FROM clause. The other clauses are optional.
BNF: subquery ::= simple_select_clause subquery_from_clause [where_clause] [groupby_clause] [having_clause]
Author
Pascal Filion
Since
2.4
Version
2.4
See Also
SimpleSelectStatement

Field Summary

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject:
GROUP_BY_CLAUSE_PROPERTYHAVING_CLAUSE_PROPERTYWHERE_CLAUSE_PROPERTY

Constructor Summary

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

Creates a new SimpleSelectStatementStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
public CollectionMemberDeclarationStateObject

Returns:

The CollectionMemberDeclarationStateObject representing the collection declaration
addDerivedCollectionDeclaration
()

Adds a new derived collection declaration to the FROM clause.

public CollectionMemberDeclarationStateObject

Returns:

The CollectionMemberDeclarationStateObject representing the collection declaration
addDerivedCollectionDeclaration
(String
The collection-valued path expression
collectionValuedPath
)

Adds a new derived collection declaration to the FROM clause.

public DerivedPathIdentificationVariableDeclarationStateObject

Returns:

The DerivedPathIdentificationVariableDeclarationStateObject representing the collection declaration
addDerivedPathDeclaration
()

Adds a new derived identification variable declaration to the FROM clause.

public DerivedPathIdentificationVariableDeclarationStateObject

Returns:

The DerivedPathIdentificationVariableDeclarationStateObject representing the path declaration
addDerivedPathDeclaration
(String
Either the derived singled-valued object field or the collection-valued path expression
path
,
String
The identification variable defining the given path
identificationVariable
)

Adds a new derived identification variable declaration to the FROM clause.

protected AbstractFromClauseStateObject
buildFromClause()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject.buildFromClause.

Creates the state object representing the FROM clause.
protected AbstractSelectClauseStateObject
buildSelectClause()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject.buildSelectClause.

Creates the state object representing the SELECT clause.
public SimpleSelectStatement
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject.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 ISimpleSelectExpressionStateObjectBuilder

Returns:

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

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 SimpleSelectClauseStateObject
public void
setExpression(SimpleSelectStatement
The parsed object representing a subquery SELECT statement
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 the SELECT clause's select item.

public void
setSelectItem(String
The portion of the query representing one or several select items
jpqlFragment
)

Parses the given JPQL fragment and create the select item.

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject:
addChildrenaddCollectionDeclarationaddCollectionDeclarationaddGroupByClauseaddGroupByClauseaddHavingClauseaddHavingClauseaddRangeDeclarationaddRangeDeclarationaddRangeDeclarationaddWhereClauseaddWhereClausedeclarationsfindIdentificationVariablegetDeclarationgetGroupByClausegetHavingClausegetWhereClausehasGroupByClausehasHavingClausehasWhereClauseidentificationVariablesinitializeisEquivalentparseSelectremoveGroupByClauseremoveHavingClauseremoveWhereClausetoggleGroupByClausetoggleHavingClausetoggleWhereClausetoTextInternal

Constructor Detail

SimpleSelectStatementStateObjectback to summary
public SimpleSelectStatementStateObject(StateObject parent)

Creates a new SimpleSelectStatementStateObject.

Parameters
parent:StateObject

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
addDerivedCollectionDeclarationback to summary
public CollectionMemberDeclarationStateObject addDerivedCollectionDeclaration()

Adds a new derived collection declaration to the FROM clause.

Returns:CollectionMemberDeclarationStateObject

The CollectionMemberDeclarationStateObject representing the collection declaration

addDerivedCollectionDeclarationback to summary
public CollectionMemberDeclarationStateObject addDerivedCollectionDeclaration(String collectionValuedPath)

Adds a new derived collection declaration to the FROM clause.

Parameters
collectionValuedPath:String

The collection-valued path expression

Returns:CollectionMemberDeclarationStateObject

The CollectionMemberDeclarationStateObject representing the collection declaration

addDerivedPathDeclarationback to summary
public DerivedPathIdentificationVariableDeclarationStateObject addDerivedPathDeclaration()

Adds a new derived identification variable declaration to the FROM clause.

Returns:DerivedPathIdentificationVariableDeclarationStateObject

The DerivedPathIdentificationVariableDeclarationStateObject representing the collection declaration

addDerivedPathDeclarationback to summary
public DerivedPathIdentificationVariableDeclarationStateObject addDerivedPathDeclaration(String path, String identificationVariable)

Adds a new derived identification variable declaration to the FROM clause.

Parameters
path:String

Either the derived singled-valued object field or the collection-valued path expression

identificationVariable:String

The identification variable defining the given path

Returns:DerivedPathIdentificationVariableDeclarationStateObject

The DerivedPathIdentificationVariableDeclarationStateObject representing the path declaration

buildFromClauseback to summary
protected AbstractFromClauseStateObject buildFromClause()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject.buildFromClause.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject.buildFromClause.

Creates the state object representing the FROM clause.

Returns:AbstractFromClauseStateObject

A concrete instance of AbstractFromClauseStateObject

Annotations
@Override
buildSelectClauseback to summary
protected AbstractSelectClauseStateObject buildSelectClause()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject.buildSelectClause.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject.buildSelectClause.

Creates the state object representing the SELECT clause.

Returns:AbstractSelectClauseStateObject

A concrete instance of AbstractSelectClauseStateObject

Annotations
@Override
getExpressionback to summary
public SimpleSelectStatement getExpression()

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

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.AbstractSelectStatementStateObject.getFromClause.

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

Returns the state object representing the FROM clause.

Returns:SimpleFromClauseStateObject

The state object representing the FROM clause, which is never null

Annotations
@Override
getSelectBuilderback to summary
public ISimpleSelectExpressionStateObjectBuilder getSelectBuilder()

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

getSelectClauseback to summary
public SimpleSelectClauseStateObject getSelectClause()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject.getSelectClause.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject.getSelectClause.

Returns the state object representing the SELECT clause.

Returns:SimpleSelectClauseStateObject

Either the actual state object representing the SELECT clause, which is never null

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

The parsed object representing a subquery SELECT statement

setSelectItemback to summary
public void setSelectItem(StateObject stateObject)

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

Parameters
stateObject:StateObject

The StateObject representing the single select item

setSelectItemback to summary
public void setSelectItem(String jpqlFragment)

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