Class SimpleSelectStatementStateObject
java.lang.Object
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject
org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleSelectStatementStateObject
- All Implemented Interfaces:
StateObject
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]
- Since:
- 2.4
- Version:
- 2.4
- See Also:
-
Field Summary
Fields inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractSelectStatementStateObject
GROUP_BY_CLAUSE_PROPERTY, HAVING_CLAUSE_PROPERTY, WHERE_CLAUSE_PROPERTY
-
Constructor Summary
ConstructorDescriptionCreates a newSimpleSelectStatementStateObject
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(StateObjectVisitor visitor) Visits thisStateObject
by the givenvisitor
.Adds a new derived collection declaration to theFROM
clause.addDerivedCollectionDeclaration
(String collectionValuedPath) Adds a new derived collection declaration to theFROM
clause.Adds a new derived identification variable declaration to theFROM
clause.addDerivedPathDeclaration
(String path, String identificationVariable) Adds a new derived identification variable declaration to theFROM
clause.protected AbstractFromClauseStateObject
Creates the state object representing theFROM
clause.protected AbstractSelectClauseStateObject
Creates the state object representing theSELECT
clause.Returns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.Returns the state object representing theFROM
clause.Creates and returns a newISimpleSelectExpressionStateObjectBuilder
that can be used to programmatically create a single select expression and once the expression is complete,ISimpleSelectExpressionStateObjectBuilder.commit()
will push theStateObject
representation of that expression as this clause's select expression.Returns the state object representing theSELECT
clause.void
setExpression
(SimpleSelectStatement 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
.void
setSelectItem
(String jpqlFragment) Parses the given JPQL fragment and create the select item.void
setSelectItem
(StateObject stateObject) Sets the givenStateObject
as theSELECT
clause's select item.Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.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.tools.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
-
Constructor Details
-
SimpleSelectStatementStateObject
Creates a newSimpleSelectStatementStateObject
.- 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
-
addDerivedCollectionDeclaration
Adds a new derived collection declaration to theFROM
clause.- Returns:
- The
CollectionMemberDeclarationStateObject
representing the collection declaration
-
addDerivedCollectionDeclaration
public CollectionMemberDeclarationStateObject addDerivedCollectionDeclaration(String collectionValuedPath) Adds a new derived collection declaration to theFROM
clause.- Parameters:
collectionValuedPath
- The collection-valued path expression- Returns:
- The
CollectionMemberDeclarationStateObject
representing the collection declaration
-
addDerivedPathDeclaration
Adds a new derived identification variable declaration to theFROM
clause.- Returns:
- The
DerivedPathIdentificationVariableDeclarationStateObject
representing the collection declaration
-
addDerivedPathDeclaration
public DerivedPathIdentificationVariableDeclarationStateObject addDerivedPathDeclaration(String path, String identificationVariable) Adds a new derived identification variable declaration to theFROM
clause.- Parameters:
path
- Either the derived singled-valued object field or the collection-valued path expressionidentificationVariable
- The identification variable defining the given path- Returns:
- The
DerivedPathIdentificationVariableDeclarationStateObject
representing the path declaration
-
buildFromClause
Description copied from class:AbstractSelectStatementStateObject
Creates the state object representing theFROM
clause.- Specified by:
buildFromClause
in classAbstractSelectStatementStateObject
- Returns:
- A concrete instance of
AbstractFromClauseStateObject
-
buildSelectClause
Description copied from class:AbstractSelectStatementStateObject
Creates the state object representing theSELECT
clause.- Specified by:
buildSelectClause
in classAbstractSelectStatementStateObject
- Returns:
- A concrete instance of
AbstractSelectClauseStateObject
-
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 classAbstractSelectStatementStateObject
- 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)
-
getFromClause
Description copied from class:AbstractSelectStatementStateObject
Returns the state object representing theFROM
clause.- Overrides:
getFromClause
in classAbstractSelectStatementStateObject
- Returns:
- The state object representing the
FROM
clause, which is nevernull
-
getSelectBuilder
Creates and returns a newISimpleSelectExpressionStateObjectBuilder
that can be used to programmatically create a single select expression and once the expression is complete,ISimpleSelectExpressionStateObjectBuilder.commit()
will push theStateObject
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
Description copied from class:AbstractSelectStatementStateObject
Returns the state object representing theSELECT
clause.- Overrides:
getSelectClause
in classAbstractSelectStatementStateObject
- Returns:
- Either the actual state object representing the
SELECT
clause, which is nevernull
-
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 a subquerySELECT
statement
-
setSelectItem
Sets the givenStateObject
as theSELECT
clause's select item.- Parameters:
stateObject
- TheStateObject
representing the single select item
-
setSelectItem
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
-