Top Description Inners Fields Constructors Methods
org.eclipse.persistence.internal.jpa.jpql

pack-priv final Class DeclarationResolver

extends Object
Class Inheritance
Annotations
@SuppressWarnings:nls
Imports
java.util.Collection, .Collections, .HashSet, .LinkedList, .List, .Set, org.eclipse.persistence.jpa.jpql.ExpressionTools, .JPQLQueryDeclaration.Type, .LiteralType, org.eclipse.persistence.jpa.jpql.parser.AbstractEclipseLinkExpressionVisitor, .AbstractSchemaName, .CollectionExpression, .CollectionMemberDeclaration, .CollectionValuedPathExpression, .DeleteClause, .DeleteStatement, .Expression, .FromClause, .IdentificationVariable, .IdentificationVariableDeclaration, .JPQLExpression, .Join, .RangeVariableDeclaration, .ResultVariable, .SelectClause, .SelectStatement, .SimpleFromClause, .SimpleSelectClause, .SimpleSelectStatement, .SubExpression, .TableVariableDeclaration, .UpdateClause, .UpdateStatement

This visitor visits the declaration clause of the JPQL query and creates the list of Declarations.
Author
Pascal Filion
Since
2.4
Version
2.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
DeclarationResolver.ResultVariableVisitor

This visitor traverses the SELECT clause and retrieves the result variables.

Field Summary

Modifier and TypeField and Description
private Declaration
baseDeclaration

The first Declaration that was created when visiting the declaration clause.

private List<Declaration>
declarations

The Declaration objects mapped to their identification variable.

private DeclarationResolver
parent

The parent DeclarationResolver which represents the superquery's declaration or null if this is used for the top-level query.

private boolean
populated

Determines whether the Declaration objects were created after visiting the query's declaration clause.

private JPQLQueryContext
queryContext

The JPQLQueryContext is used to query information about the application metadata and cached information.

private Collection<IdentificationVariable>
resultVariables

The result variables used to identify select expressions.

Constructor Summary

AccessConstructor and Description
pack-priv
DeclarationResolver(JPQLQueryContext
The context used to query information about the application metadata and cached information
queryContext
,
DeclarationResolver
The parent DeclarationResolver which represents the superquery's declaration
parent
)

Creates a new DeclarationResolver.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addRangeVariableDeclaration(String
The name of the entity to be accessible with the given variable name
entityName
,
String
The identification variable used to navigate to the entity
variableName
)

Adds a "virtual" range variable declaration that will be used when parsing a JPQL fragment.

pack-priv void
convertUnqualifiedDeclaration(RangeDeclaration
The Declaration that was parsed to range over an abstract schema name but is actually ranging over a path expression
declaration
,
String
The identification variable coming from the parent identification variable declaration
outerVariableName
)

Converts the given Declaration from being set as a range variable declaration to a path expression declaration.

pack-priv Declaration

Returns:

The Declaration containing the information about the identification variable declaration
getDeclaration
(String
The name of the identification variable that is used to navigate a "root" object
variableName
)

Retrieves the Declaration for which the given variable name is used to navigate to the "root" object.

pack-priv List<Declaration>

Returns:

The Declarations of the current query that was parsed
getDeclarations
()

Returns the ordered list of Declarations.

pack-priv Declaration

Returns:

The first Declaration object
getFirstDeclaration
()

Returns the first Declaration that was created after visiting the declaration clause.

pack-priv Collection<Join>

Returns:

The JOIN FETCH expressions used in the same declaration or an empty collection if none was defined
getJoinFetches
(String
The name of the identification variable that should be used to define an entity
variableName
)

Returns the parsed representation of a JOIN FETCH that were defined in the same declaration than the given range identification variable name.

pack-priv DeclarationResolver

Returns:

The parent of this DeclarationResolver if this is used for a subquery or null if this is used for the top-level query
getParent
()

Returns the parent of this DeclarationResolver.

pack-priv Collection<IdentificationVariable>

Returns:

The variables identifying the select expressions, if any was defined or an empty set if none were defined
getResultVariables
()

Returns the variables that got defined in the select expression.

private void
initialize(JPQLQueryContext
The context used to query information about the query
queryContext
,
DeclarationResolver
The parent DeclarationResolver, which is not null when this resolver is created for a subquery
parent
)

Initializes this DeclarationResolver.

pack-priv boolean

Returns:

true if the given identification variable maps a collection-valued field defined in a JOIN or IN expression; false otherwise
isCollectionIdentificationVariable
(String
The identification variable to check for what it maps
variableName
)

Determines whether the given identification variable is defining a JOIN expression or in a IN expressions for a collection-valued field.

pack-priv boolean

Returns:

true if the given identification variable maps a collection-valued field defined in a JOIN or IN expression; false otherwise
isCollectionIdentificationVariableImp
(String
The identification variable to check for what it maps
variableName
)

Determines whether the given identification variable is defining a JOIN expression or in a IN expressions for a collection-valued field.

pack-priv boolean

Returns:

true if the variable name is mapping an abstract schema name; false if it's defined in a collection member declaration
isRangeIdentificationVariable
(String
The name of the variable to verify if it's defined in a range variable declaration in the current query or any parent query
variableName
)

Determines whether the given variable name is an identification variable name used to define an abstract schema name.

private boolean
pack-priv boolean

Returns:

true if the given variable is defined as a result variable; false otherwise
isResultVariable
(String
The variable to check if it used to identify a select expression
variableName
)

Determines whether the given variable is a result variable or not.

pack-priv void
populate(Expression
The Expression to visit in order to retrieve the information contained in the given query's declaration
expression
)

Visits the given Expression (which is either the top-level query or a subquery) and retrieve the information from its declaration clause.

private void
populateImp(Expression expression)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait