|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.jpa.jpql.Resolver org.eclipse.persistence.jpa.jpql.DeclarationResolver
public class DeclarationResolver
This Resolver
is responsible to visit the current query (which is either the top-level
query or a subquery) and gathers the information from the declaration clause. For a SELECT
or DELETE clause, the information will be retrieved from the FROM clause. For an
UDPATE
clause, it will be retrieved from the unique identification range variable
declaration.
Nested Class Summary | |
---|---|
static class |
DeclarationResolver.Declaration
A Declaration represents either an identification variable declaration or a
collection member declaration. |
protected class |
DeclarationResolver.DeclarationVisitor
|
protected class |
DeclarationResolver.QualifyRangeDeclarationVisitor
|
protected class |
DeclarationResolver.RootObjectExpressionVisitor
This visitor takes care to support a subquery defined as a "root" object. |
Constructor Summary | |
---|---|
DeclarationResolver(DeclarationResolver parent,
JPQLQueryContext queryContext)
Creates a new DeclarationResolver . |
Method Summary | |
---|---|
void |
accept(ResolverVisitor visitor)
Visits this Resolver by the given visitor . |
protected void |
addDeclaration(DeclarationResolver.Declaration declaration)
Adds the given DeclarationResolver.Declaration at the end of the list. |
void |
addRangeVariableDeclaration(java.lang.String entityName,
java.lang.String variableName)
Registers a range variable declaration that will be used when a JPQL fragment is parsed. |
protected DeclarationResolver.DeclarationVisitor |
buildDeclarationVisitor()
|
protected DeclarationResolver.RootObjectExpressionVisitor |
buildRootObjectExpressionVisitor()
|
protected IType |
buildType()
Resolves the IType of the property handled by this Resolver . |
protected ITypeDeclaration |
buildTypeDeclaration()
Resolves the ITypeDeclaration of the property handled by this Resolver . |
protected void |
checkParent(Resolver parent)
|
void |
convertUnqualifiedDeclaration(DeclarationResolver.Declaration declaration,
java.lang.String outerVariableName)
Converts the given DeclarationResolver.Declaration from being set as a range variable declaration to
a path expression declaration. |
void |
dispose()
Disposes the internal data. |
java.util.List<DeclarationResolver.Declaration> |
getDeclarations()
Returns the ordered list of Declarations . |
protected DeclarationResolver.DeclarationVisitor |
getDeclarationVisitor()
|
java.util.Collection<Join> |
getJoins(java.lang.String variableName)
Returns the parsed representation of a JOIN and JOIN FETCH that were defined in the same declaration than the given range identification variable name. |
protected java.util.Collection<Join> |
getJoinsImp(java.lang.String variableName)
|
DeclarationResolver |
getParent()
Returns the parent of this Resolver . |
protected IQuery |
getQuery()
Returns the external form representing the JPQL query. |
protected JPQLQueryContext |
getQueryContext()
Returns the JPQLQueryContext that is used by this visitor. |
Resolver |
getResolver(java.lang.String variableName)
Retrieves the Resolver mapped with the given identification variable. |
protected Resolver |
getResolverImp(java.lang.String variableName)
|
java.util.Set<java.lang.String> |
getResultVariables()
Returns the variables that got defined in the select expression. |
java.util.Map<IdentificationVariable,java.lang.String> |
getResultVariablesMap()
Returns the map of result variables that got used to define a select expression. |
protected DeclarationResolver.RootObjectExpressionVisitor |
getRootObjectExpressionVisitor()
|
boolean |
hasJoins()
Determines whether the JPQL expression has JOIN expressions. |
protected void |
initialize(JPQLQueryContext queryContext)
Initializes this DeclarationResolver . |
boolean |
isCollectionIdentificationVariable(java.lang.String variableName)
Determines whether the given identification variable is defining a JOIN or IN
expressions for a collection-valued field. |
protected boolean |
isCollectionIdentificationVariableImp(java.lang.String variableName)
|
boolean |
isRangeIdentificationVariable(java.lang.String variableName)
Determines whether the given variable name is an identification variable name used to define an abstract schema name. |
protected boolean |
isRangeIdentificationVariableImp(java.lang.String variableName)
|
boolean |
isResultVariable(java.lang.String variable)
Determines if the given variable is a result variable. |
void |
populate(Expression expression)
Visits the current query (which is either the top-level query or a subquery) and gathers the information from the declaration clause. |
protected DeclarationResolver.QualifyRangeDeclarationVisitor |
qualifyRangeDeclarationVisitor()
|
protected Resolver |
resolveRootObject(Expression expression)
Resolves the "root" object represented by the given Expression . |
protected java.lang.String |
visitDeclaration(Expression expression,
Expression identificationVariable)
|
Methods inherited from class org.eclipse.persistence.jpa.jpql.Resolver |
---|
addChild, getChild, getManagedType, getMapping, getParentManagedType, getParentMapping, getParentType, getParentTypeDeclaration, getProvider, getType, getType, getType, getTypeDeclaration, getTypeHelper, getTypeRepository, isNullAllowed, setNullAllowed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DeclarationResolver(DeclarationResolver parent, JPQLQueryContext queryContext)
DeclarationResolver
.
parent
- The parent resolver if this is used for a subquery or null if it's used for the
top-level queryqueryContext
- The context used to query information about the queryMethod Detail |
---|
public void accept(ResolverVisitor visitor)
Resolver
by the given visitor
.
accept
in class Resolver
visitor
- The visitor
to visit this objectprotected final void addDeclaration(DeclarationResolver.Declaration declaration)
DeclarationResolver.Declaration
at the end of the list.
declaration
- The DeclarationResolver.Declaration
representing a single variable declarationpublic void addRangeVariableDeclaration(java.lang.String entityName, java.lang.String variableName)
entityName
- The name of the entity to be accessible with the given variable namevariableName
- The identification variable used to navigate to the entityprotected DeclarationResolver.DeclarationVisitor buildDeclarationVisitor()
protected DeclarationResolver.RootObjectExpressionVisitor buildRootObjectExpressionVisitor()
protected IType buildType()
IType
of the property handled by this Resolver
.
buildType
in class Resolver
IType
that was resolved by this Resolver
or the IType
for IType.UNRESOLVABLE_TYPE
if it could not be resolvedprotected ITypeDeclaration buildTypeDeclaration()
ITypeDeclaration
of the property handled by this Resolver
.
buildTypeDeclaration
in class Resolver
ITypeDeclaration
that was resolved by this Resolver
or the
ITypeDeclaration
for IType.UNRESOLVABLE_TYPE
if it could not be resolvedprotected void checkParent(Resolver parent)
checkParent
in class Resolver
public void convertUnqualifiedDeclaration(DeclarationResolver.Declaration declaration, java.lang.String outerVariableName)
DeclarationResolver.Declaration
from being set as a range variable declaration to
a path expression declaration.
In this query "UPDATE Employee SET firstName = 'MODIFIED' WHERE (SELECT COUNT(m) FROM
managedEmployees m) > 0
" managedEmployees is an unqualified collection-valued
path expression (employee.managedEmployees
).
declaration
- The DeclarationResolver.Declaration
that was parsed to range over an abstract schema
name but is actually ranging over a path expressionouterVariableName
- The identification variable coming from the parent identification
variable declarationpublic void dispose()
public java.util.List<DeclarationResolver.Declaration> getDeclarations()
Declarations
.
Declarations
of the current query that was parsedprotected DeclarationResolver.DeclarationVisitor getDeclarationVisitor()
public java.util.Collection<Join> getJoins(java.lang.String variableName)
variableName
- The name of the identification variable that should be used to define an
abstract schema name
protected java.util.Collection<Join> getJoinsImp(java.lang.String variableName)
public DeclarationResolver getParent()
Resolver
.
getParent
in class Resolver
Resolver
protected IQuery getQuery()
getQuery
in class Resolver
protected JPQLQueryContext getQueryContext()
JPQLQueryContext
that is used by this visitor.
JPQLQueryContext
holding onto the JPQL query and the cached informationpublic Resolver getResolver(java.lang.String variableName)
Resolver
mapped with the given identification variable. If the
identification is not defined in the declaration traversed by this resolver, than the search
will traverse the parent hierarchy.
variableName
- The identification variable that maps a Resolver
Resolver
mapped with the given identification variableprotected Resolver getResolverImp(java.lang.String variableName)
public java.util.Set<java.lang.String> getResultVariables()
public java.util.Map<IdentificationVariable,java.lang.String> getResultVariablesMap()
protected DeclarationResolver.RootObjectExpressionVisitor getRootObjectExpressionVisitor()
public boolean hasJoins()
true
if the query or subquery being traversed contains JOIN
expressions; false
otherwiseprotected void initialize(JPQLQueryContext queryContext)
DeclarationResolver
.
queryContext
- The context used to query information about the querypublic boolean isCollectionIdentificationVariable(java.lang.String variableName)
IN
expressions for a collection-valued field.
variableName
- The identification variable to check for what it maps
true
if the given identification variable maps a collection-valued field
defined in a JOIN
or IN
expression; false
if it's not
defined or it's mapping an abstract schema nameprotected boolean isCollectionIdentificationVariableImp(java.lang.String variableName)
public boolean isRangeIdentificationVariable(java.lang.String variableName)
variableName
- The name of the variable to verify if it's defined in a range variable
declaration in the current query or any parent query
true
if the variable name is mapping an abstract schema name; false
if it's defined in a collection member declarationprotected boolean isRangeIdentificationVariableImp(java.lang.String variableName)
public boolean isResultVariable(java.lang.String variable)
variable
- The variable to check if it's a result variable
true
if the given variable is defined as a result variable; false
otherwisepublic void populate(Expression expression)
expression
- The Expression
to visit in order to retrieve the information
contained in the given query's declarationprotected DeclarationResolver.QualifyRangeDeclarationVisitor qualifyRangeDeclarationVisitor()
protected Resolver resolveRootObject(Expression expression)
Expression
. This will also handle
using a subquery in the FROM
clause. This is only support for EclipseLink.
expression
-
protected java.lang.String visitDeclaration(Expression expression, Expression identificationVariable)
|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |