Class RangeVariableDeclarationStateObject
- 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.RangeVariableDeclarationStateObject
-
- All Implemented Interfaces:
StateObject
,VariableDeclarationStateObject
public class RangeVariableDeclarationStateObject extends AbstractRangeVariableDeclarationStateObject
Range variable declarations allow the developer to designate a "root" for objects which may not be reachable by navigation. In order to select values by comparing more than one instance of an entity abstract schema type, more than one identification variable ranging over the abstract schema type is needed in theFROM
clause.BNF:range_variable_declaration ::= abstract_schema_name [AS] identification_variable
- 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 RangeVariableDeclarationStateObject(AbstractModifyClauseStateObject parent)
Creates a newRangeVariableDeclarationStateObject
.RangeVariableDeclarationStateObject(IdentificationVariableDeclarationStateObject parent)
Creates a newRangeVariableDeclarationStateObject
.RangeVariableDeclarationStateObject(IdentificationVariableDeclarationStateObject parent, java.lang.String entityName)
Creates a newRangeVariableDeclarationStateObject
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(StateObjectVisitor visitor)
Visits thisStateObject
by the givenvisitor
.RangeVariableDeclarationStateObject
addAs()
Makes sure theAS
identifier is specified.protected StateObject
buildRootStateObject()
IEntity
getEntity()
Returns the actualIEntity
that has the abstract schema name.java.lang.String
getEntityName()
Returns the abstract schema name.IManagedType
getManagedType(StateObject stateObject)
Returns theIManagedType
for the given identification variable.java.lang.String
getRootPath()
Returns the "root" object for objects which may not be reachable by navigation.AbstractSchemaNameStateObject
getRootStateObject()
Returns theStateObject
holding onto the abstract schema name.void
setDeclaration(java.lang.String entityName, java.lang.String identificationVariable)
Sets the abstract schema name to the given value and the identification variable that will range over it.void
setDeclaration(IEntity entity)
Sets the abstract schema name to the given value.void
setDeclaration(IEntity entity, java.lang.String identificationVariable)
Sets the abstract schema name to the given value and the identification variable that will range over it.void
setEntity(IEntity entity)
Sets the actualIEntity
and updates the abstract schema name.void
setEntityName(java.lang.String abstractSchemaName)
Sets the name of the abstract schema, which is the name of the entity.void
setRootPath(java.lang.String root)
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
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, 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
-
Methods inherited from interface org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
addPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toText
-
-
-
-
Constructor Detail
-
RangeVariableDeclarationStateObject
public RangeVariableDeclarationStateObject(AbstractModifyClauseStateObject parent)
Creates a newRangeVariableDeclarationStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
java.lang.NullPointerException
- The given parent cannot benull
-
RangeVariableDeclarationStateObject
public RangeVariableDeclarationStateObject(IdentificationVariableDeclarationStateObject parent)
Creates a newRangeVariableDeclarationStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
- Throws:
java.lang.NullPointerException
- The given parent cannot benull
-
RangeVariableDeclarationStateObject
public RangeVariableDeclarationStateObject(IdentificationVariableDeclarationStateObject parent, java.lang.String entityName)
Creates a newRangeVariableDeclarationStateObject
.- Parameters:
parent
- The parent of this state object, which cannot benull
entityName
- The name of the abstract schema, which is the name of the entity- 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
-
addAs
public RangeVariableDeclarationStateObject addAs()
Makes sure theAS
identifier is specified.- Overrides:
addAs
in classAbstractRangeVariableDeclarationStateObject
- Returns:
- This object
-
buildRootStateObject
protected StateObject buildRootStateObject()
- Specified by:
buildRootStateObject
in classAbstractRangeVariableDeclarationStateObject
-
getEntity
public IEntity getEntity()
Returns the actualIEntity
that has the abstract schema name.- Returns:
- The actual
IEntity
ornull
if no entity exists
-
getEntityName
public java.lang.String getEntityName()
Returns the abstract schema name.- Returns:
- The name of the abstract schema type for which the identification variable is ranging over
-
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
-
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 AbstractSchemaNameStateObject getRootStateObject()
Returns theStateObject
holding onto the abstract schema name.- Overrides:
getRootStateObject
in classAbstractRangeVariableDeclarationStateObject
- Returns:
- The
StateObject
, which is nevernull
-
setDeclaration
public void setDeclaration(IEntity entity)
Sets the abstract schema name to the given value.- Parameters:
entity
- TheIEntity
that this clause will range over
-
setDeclaration
public void setDeclaration(IEntity entity, java.lang.String identificationVariable)
Sets the abstract schema name to the given value and the identification variable that will range over it.- Parameters:
entity
- TheIEntity
that this clause will range overidentificationVariable
- The new identification variable
-
setDeclaration
public void setDeclaration(java.lang.String entityName, java.lang.String identificationVariable)
Sets the abstract schema name to the given value and the identification variable that will range over it.- Parameters:
entityName
- The name of the entity nameidentificationVariable
- The new identification variable
-
setEntity
public void setEntity(IEntity entity)
Sets the actualIEntity
and updates the abstract schema name.- Parameters:
entity
- TheIEntity
that the clause will range over
-
setEntityName
public void setEntityName(java.lang.String abstractSchemaName)
Sets the name of the abstract schema, which is the name of the entity.- Parameters:
abstractSchemaName
- The name of the abstract schema, which is the name of the entity
-
setRootPath
public void setRootPath(java.lang.String root)
Sets the "root" object for objects which may not be reachable by navigation.- Specified by:
setRootPath
in classAbstractRangeVariableDeclarationStateObject
- Parameters:
root
- The "root" object
-
-