EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jpa.jpql.model.query
Class SimpleSelectStatementStateObject

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.model.query.AbstractStateObject
      extended by org.eclipse.persistence.jpa.jpql.model.query.AbstractSelectStatementStateObject
          extended by org.eclipse.persistence.jpa.jpql.model.query.SimpleSelectStatementStateObject
All Implemented Interfaces:
StateObject

public class SimpleSelectStatementStateObject
extends AbstractSelectStatementStateObject

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]

Version:
2.4
See Also:
SimpleSelectStatement
Author:
Pascal Filion
Since:
2.4

Field Summary
 
Fields inherited from class org.eclipse.persistence.jpa.jpql.model.query.AbstractSelectStatementStateObject
GROUP_BY_CLAUSE_PROPERTY, HAVING_CLAUSE_PROPERTY, WHERE_CLAUSE_PROPERTY
 
Constructor Summary
SimpleSelectStatementStateObject(StateObject parent)
          Creates a new SimpleSelectStatementStateObject.
 
Method Summary
 void accept(StateObjectVisitor visitor)
          Visits this StateObject by the given visitor.
 CollectionMemberDeclarationStateObject addDerivedCollectionDeclaration()
          Adds a new derived collection declaration to the FROM clause.
 CollectionMemberDeclarationStateObject addDerivedCollectionDeclaration(java.lang.String collectionValuedPath)
          Adds a new derived collection declaration to the FROM clause.
 DerivedPathIdentificationVariableDeclarationStateObject addDerivedPathDeclaration()
          Adds a new derived identification variable declaration to the FROM clause.
 DerivedPathIdentificationVariableDeclarationStateObject addDerivedPathDeclaration(java.lang.String path, java.lang.String identificationVariable)
          Adds a new derived identification variable declaration to the FROM clause.
protected  AbstractFromClauseStateObject buildFromClause()
          Creates the state object representing the FROM clause.
protected  AbstractSelectClauseStateObject buildSelectClause()
          Creates the state object representing the SELECT clause.
 SimpleSelectStatement getExpression()
          Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.
 SimpleFromClauseStateObject getFromClause()
          Returns the state object representing the FROM clause.
 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.
 SimpleSelectClauseStateObject getSelectClause()
          Returns the state object representing the SELECT clause.
 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.
 void setSelectItem(StateObject stateObject)
          Sets the given StateObject as the SELECT clause's select item.
 void setSelectItem(java.lang.String jpqlFragment)
          Parses the given JPQL fragment and create the select item.
 
Methods inherited from class org.eclipse.persistence.jpa.jpql.model.query.AbstractSelectStatementStateObject
addChildren, addCollectionDeclaration, addCollectionDeclaration, addGroupByClause, addGroupByClause, addHavingClause, addHavingClause, addRangeDeclaration, addRangeDeclaration, addRangeDeclaration, addWhereClause, addWhereClause, declarations, findIdentificationVariable, getDeclaration, getGroupByClause, getHavingClause, getWhereClause, hasGroupByClause, hasHavingClause, hasWhereClause, identificationVariables, initialize, isEquivalent, parseSelect, removeGroupByClause, removeHavingClause, removeWhereClause, toggleGroupByClause, toggleHavingClause, toggleWhereClause, toTextInternal
 
Methods inherited from class org.eclipse.persistence.jpa.jpql.model.query.AbstractStateObject
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, firePropertyChanged, getChangeSupport, getDecorator, getGrammar, getManagedTypeProvider, getParent, 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
 

Constructor Detail

SimpleSelectStatementStateObject

public SimpleSelectStatementStateObject(StateObject parent)
Creates a new SimpleSelectStatementStateObject.

Parameters:
parent - The parent of this state object, which cannot be null
Throws:
java.lang.NullPointerException - The given parent cannot be null
Method Detail

accept

public void accept(StateObjectVisitor visitor)
Visits this StateObject by the given visitor.

Parameters:
visitor - The visitor to visit this object

addDerivedCollectionDeclaration

public CollectionMemberDeclarationStateObject addDerivedCollectionDeclaration()
Adds a new derived collection declaration to the FROM clause.

Returns:
The CollectionMemberDeclarationStateObject representing the collection declaration

addDerivedCollectionDeclaration

public CollectionMemberDeclarationStateObject addDerivedCollectionDeclaration(java.lang.String collectionValuedPath)
Adds a new derived collection declaration to the FROM clause.

Parameters:
collectionValuedPath - The collection-valued path expression
Returns:
The CollectionMemberDeclarationStateObject representing the collection declaration

addDerivedPathDeclaration

public DerivedPathIdentificationVariableDeclarationStateObject addDerivedPathDeclaration()
Adds a new derived identification variable declaration to the FROM clause.

Returns:
The DerivedPathIdentificationVariableDeclarationStateObject representing the collection declaration

addDerivedPathDeclaration

public DerivedPathIdentificationVariableDeclarationStateObject addDerivedPathDeclaration(java.lang.String path,
                                                                                         java.lang.String identificationVariable)
Adds a new derived identification variable declaration to the FROM clause.

Parameters:
path - Either the derived singled-valued object field or the collection-valued path expression
identificationVariable - The identification variable defining the given path
Returns:
The DerivedPathIdentificationVariableDeclarationStateObject representing the path declaration

buildFromClause

protected AbstractFromClauseStateObject buildFromClause()
Creates the state object representing the FROM clause.

Specified by:
buildFromClause in class AbstractSelectStatementStateObject
Returns:
A concrete instance of AbstractFromClauseStateObject

buildSelectClause

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

Specified by:
buildSelectClause in class AbstractSelectStatementStateObject
Returns:
A concrete instance of AbstractSelectClauseStateObject

getExpression

public SimpleSelectStatement getExpression()
Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

Specified by:
getExpression in interface StateObject
Overrides:
getExpression in class AbstractSelectStatementStateObject
Returns:
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)

getFromClause

public SimpleFromClauseStateObject getFromClause()
Returns the state object representing the FROM clause.

Overrides:
getFromClause in class AbstractSelectStatementStateObject
Returns:
The state object representing the FROM clause, which is never null

getSelectBuilder

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:
A new builder that can be used to quickly create a select expression

getSelectClause

public SimpleSelectClauseStateObject getSelectClause()
Returns the state object representing the SELECT clause.

Overrides:
getSelectClause in class AbstractSelectStatementStateObject
Returns:
Either the actual state object representing the SELECT clause, which is never null

setExpression

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 - The parsed object representing a subquery SELECT

setSelectItem

public void setSelectItem(StateObject stateObject)
Sets the given StateObject as the SELECT clause's select item.

Parameters:
stateObject - The StateObject representing the single select item

setSelectItem

public void setSelectItem(java.lang.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 - The portion of the query representing one or several select items

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference