Class DerivedPathVariableDeclarationStateObject
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractRangeVariableDeclarationStateObject
-
- org.eclipse.persistence.jpa.jpql.tools.model.query.DerivedPathVariableDeclarationStateObject
-
- All Implemented Interfaces:
StateObject
,VariableDeclarationStateObject
public class DerivedPathVariableDeclarationStateObject extends AbstractRangeVariableDeclarationStateObject
BNF:subselect_identification_variable_declaration ::= derived_path_expression [AS] identification_variable {join}*
BNF:derived_path_expression ::= superquery_identification_variable.{single_valued_object_field.}*collection_valued_field | superquery_identification_variable.{single_valued_object_field.}*single_valued_object_field
- Version:
- 2.4
- See Also:
RangeVariableDeclaration
- Author:
- Pascal Filion
- Since:
- 2.4
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractRangeVariableDeclarationStateObject
AS_PROPERTY, IDENTIFICATION_VARIABLE_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description DerivedPathVariableDeclarationStateObject(DerivedPathIdentificationVariableDeclarationStateObject parent)
Creates a newDerivedPathVariableDeclarationStateObject
.DerivedPathVariableDeclarationStateObject(DerivedPathIdentificationVariableDeclarationStateObject parent, java.lang.String path)
Creates a newDerivedPathVariableDeclarationStateObject
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(StateObjectVisitor visitor)
Visits thisStateObject
by the givenvisitor
.protected StateObject
buildRootStateObject()
IManagedType
getManagedType(StateObject stateObject)
Returns theIManagedType
for the given identification variable.DerivedPathIdentificationVariableDeclarationStateObject
getParent()
Returns the parent of thisStateObject
.java.lang.String
getPath()
Returns the string representation of the path expression.java.lang.String
getRootPath()
Returns the "root" object for objects which may not be reachable by navigation.CollectionValuedPathExpressionStateObject
getRootStateObject()
Returns theStateObject
holding onto the abstract schema name.void
setRootPath(java.lang.String path)
Sets the "root" object for objects which may not be reachable by navigation.-
Methods inherited from class org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractRangeVariableDeclarationStateObject
addAs, addChildren, addProblems, getExpression, getIdentificationVariable, getIdentificationVariableStateObject, hasAs, hasIdentificationVariable, identificationVariables, initialize, isEquivalent, isIdentificationVariableOptional, isIdentificationVariableVirtual, setAs, setExpression, setIdentificationVariable, setIdentificationVariableOptional, toggleAs, toTextInternal
-
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, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, 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, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
-
-
-
-
Constructor Detail
-
DerivedPathVariableDeclarationStateObject
public DerivedPathVariableDeclarationStateObject(DerivedPathIdentificationVariableDeclarationStateObject parent)
Creates a newDerivedPathVariableDeclarationStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
java.lang.NullPointerException
- The given parent cannot benull
-
DerivedPathVariableDeclarationStateObject
public DerivedPathVariableDeclarationStateObject(DerivedPathIdentificationVariableDeclarationStateObject parent, java.lang.String path)
Creates a newDerivedPathVariableDeclarationStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
path
- Either the derived singled-valued object path expression or the collection-valued path expression- 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
-
buildRootStateObject
protected StateObject buildRootStateObject()
- Specified by:
buildRootStateObject
in classAbstractRangeVariableDeclarationStateObject
-
getManagedType
public IManagedType getManagedType(StateObject stateObject)
Returns theIManagedType
for the given identification variable. The search does not traverse up the query hierarchy if this declaration is for a subquery.
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
-
getParent
public DerivedPathIdentificationVariableDeclarationStateObject getParent()
Returns the parent of thisStateObject
.- Specified by:
getParent
in interfaceStateObject
- Overrides:
getParent
in classAbstractStateObject
- Returns:
- Returns the parent of this
StateObject
, which isnull
only when this is the root of the hierarchy
-
getPath
public java.lang.String getPath()
Returns the string representation of the path expression. If the identification variable is virtual, then it is not part of the result.- Returns:
- The path expression, which is never
null
-
getRootPath
public java.lang.String getRootPath()
Returns the "root" object for objects which may not be reachable by navigation.- Specified by:
getRootPath
in classAbstractRangeVariableDeclarationStateObject
- Returns:
- The "root" object
-
getRootStateObject
public CollectionValuedPathExpressionStateObject getRootStateObject()
Returns theStateObject
holding onto the abstract schema name.- Overrides:
getRootStateObject
in classAbstractRangeVariableDeclarationStateObject
- Returns:
- The
StateObject
, which is nevernull
-
setRootPath
public void setRootPath(java.lang.String path)
Sets the "root" object for objects which may not be reachable by navigation.- Specified by:
setRootPath
in classAbstractRangeVariableDeclarationStateObject
- Parameters:
path
- The "root" object
-
-