Class SimpleFromClauseStateObject
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject<VariableDeclarationStateObject>
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractFromClauseStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleFromClauseStateObject
-
- All Implemented Interfaces:
DeclarationStateObject
,ListHolderStateObject<VariableDeclarationStateObject>
,StateObject
public class SimpleFromClauseStateObject extends AbstractFromClauseStateObject
TheFROM
clause of a sub-query defines the domain of the sub-query by declaring identification variables. An identification variable is an identifier declared in theFROM
clause of a sub-query. The domain of the sub-query may be constrained by path expressions. Identification variables designate instances of a particular entity abstract schema type. TheFROM
clause can contain multiple identification variable declarations separated by a comma (,).BNF: subquery_from_clause ::= FROM subselect_identification_variable_declaration {, subselect_identification_variable_declaration}*
- Version:
- 2.4
- See Also:
SimpleFromClause
- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractFromClauseStateObject
VARIABLE_DECLARATIONS_LIST
-
-
Constructor Summary
Constructors Constructor Description SimpleFromClauseStateObject(SimpleSelectStatementStateObject parent)
Creates a newSimpleFromClauseStateObject
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(StateObjectVisitor visitor)
Visits thisStateObject
by the givenvisitor
.CollectionMemberDeclarationStateObject
addDerivedCollectionDeclaration()
Adds a new derived collection declaration to theFROM
clause.CollectionMemberDeclarationStateObject
addDerivedCollectionDeclaration(java.lang.String collectionValuedPath)
Adds a new derived collection declaration to theFROM
clause.DerivedPathIdentificationVariableDeclarationStateObject
addDerivedPathDeclaration()
Adds a new derived identification variable declaration to theFROM
clause.DerivedPathIdentificationVariableDeclarationStateObject
addDerivedPathDeclaration(java.lang.String path, java.lang.String identificationVariable)
Adds a new derived identification variable declaration to theFROM
clause.java.lang.String
declarationBNF()
Returns the BNF of the declaration part of this clause.IManagedType
findManagedType(StateObject stateObject)
Returns theIManagedType
for the given identification variable.SimpleFromClause
getExpression()
Returns the actual parsed object if thisStateObject
representation of the JPQL query was created by parsing an existing JPQL query.SimpleSelectStatementStateObject
getParent()
Returns the parent of thisStateObject
.void
setExpression(SimpleFromClause 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
.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractFromClauseStateObject
addCollectionDeclaration, addCollectionDeclaration, addProblems, addRangeDeclaration, addRangeDeclaration, addRangeDeclaration, declarations, findIdentificationVariable, getDeclaration, getManagedType, identificationVariables, isEquivalent, listName, parse, toTextInternal
-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject
addChildren, addItem, addItems, addListChangeListener, areChildrenEquivalent, canMoveDown, canMoveUp, getItem, hasItems, initialize, items, itemsSize, moveDown, moveUp, removeItem, removeItems, removeListChangeListener, toStringItems
-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
acceptUnknownVisitor, acceptUnknownVisitor, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, firePropertyChanged, getChangeSupport, getDecorator, getGrammar, getManagedTypeProvider, 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
-
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
addPropertyChangeListener, children, decorate, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
-
-
-
-
Constructor Detail
-
SimpleFromClauseStateObject
public SimpleFromClauseStateObject(SimpleSelectStatementStateObject parent)
Creates a newSimpleFromClauseStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
java.lang.NullPointerException
- The given parent cannot benull
-
-
Method Detail
-
accept
public void accept(StateObjectVisitor visitor)
Visits thisStateObject
by the givenvisitor
.- Parameters:
visitor
- Thevisitor
to visit this object
-
addDerivedCollectionDeclaration
public CollectionMemberDeclarationStateObject addDerivedCollectionDeclaration()
Adds a new derived collection declaration to theFROM
clause.- Returns:
- The
CollectionMemberDeclarationStateObject
representing the collection declaration
-
addDerivedCollectionDeclaration
public CollectionMemberDeclarationStateObject addDerivedCollectionDeclaration(java.lang.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
public DerivedPathIdentificationVariableDeclarationStateObject addDerivedPathDeclaration()
Adds a new derived identification variable declaration to theFROM
clause.- Returns:
- The
DerivedPathIdentificationVariableDeclarationStateObject
representing the path declaration
-
addDerivedPathDeclaration
public DerivedPathIdentificationVariableDeclarationStateObject addDerivedPathDeclaration(java.lang.String path, java.lang.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
-
declarationBNF
public java.lang.String declarationBNF()
Returns the BNF of the declaration part of this clause.- Specified by:
declarationBNF
in classAbstractFromClauseStateObject
- Returns:
- The BNF of the declaration part of this clause
-
findManagedType
public IManagedType findManagedType(StateObject stateObject)
Returns theIManagedType
for the given identification variable. If the declaration is for a subquery and there is no managed type associated with the identification then the search will traverse up the query hierarchy.
In the above query, the managed type associated with the identification variable:SELECT e FROM Department d JOIN KEY(d.employees).addresses a
- d is "Department"
- a is "Address"
- Parameters:
stateObject
- TheStateObject
that should be an simple identification variable or an encapsulated identification variable with the identifierKEY
orVALUE
- Returns:
- The
IManagedType
representing the domain object declared by the given identification variable - See Also:
DeclarationStateObject.getManagedType(StateObject)
-
getExpression
public SimpleFromClause getExpression()
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 classAbstractFromClauseStateObject
- 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)
-
getParent
public SimpleSelectStatementStateObject getParent()
Returns the parent of thisStateObject
.- Specified by:
getParent
in interfaceStateObject
- Overrides:
getParent
in classAbstractFromClauseStateObject
- Returns:
- Returns the parent of this
StateObject
, which isnull
only when this is the root of the hierarchy
-
setExpression
public void setExpression(SimpleFromClause 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
.- Parameters:
expression
- Theparsed object
representing a subqueryFROM
clause
-
-