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

public Class ParseTreeContext

extends Object
Class Inheritance
Imports
java.util.ArrayList, .HashMap, .HashSet, .Iterator, .List, .Map, .Set, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.JPQLException

INTERNAL

Purpose: The ParseTreeContext holds and manages context information for the parse tree for validation.

Responsibilities:

Author
Jon Driscoll and Joel Lucuik
Since
TopLink 4.0
See Also
ParseTree

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
ParseTreeContext.VariableDecl

INTERNAL Class defining the type of the values the variableDecls map.

Field Summary

Modifier and TypeField and Description
private String
private int
private Map<String, List<Node>>
private NodeFactory
private Set<String>
private List<String>
private Map<String, Object>
private String
private TypeHelper
private Map<String, ParseTreeContext.VariableDecl>

Constructor Summary

AccessConstructor and Description
public
ParseTreeContext(NodeFactory nodeFactory, String queryInfo)

INTERNAL Return a new initialized ParseTreeContext

Method Summary

Modifier and TypeMethod and Description
public void
addParameter(String parameterName)

INTERNAL Add a parameter.

public Class<?>
classForSchemaName(String schemaName, GenerationContext context)

INTERNAL Answer the class associated with the provided schema name

public void
defineParameterType(String parameterName, Object parameterType, int line, int column)

INTERNAL Defines the type of the parameter with the specified name.

public void
enterScope()

INTERNAL Enters a new scope.

public String
public List<Node>
getFetchJoins(String variableName)

Returns a list of FETCH JOIN nodes for the specified attached to the specified variable.

public NodeFactory
public Set<String>
getOuterScopeVariables()

INTERNAL Returns the set of outer scope variables.

public List<String>
getParameterNames()

INTERNAL Return the parameter names.

public Object
getParameterType(String parameter)

INTERNAL Return the type of the specified parameter.

public String
public TypeHelper
getTypeHelper()

INTERNAL Returns the type helper stored in this context.

public Set<String>
getUnusedVariables()

Returns s set of variables that are declared in the current scope, but not used in the query.

public String
getVariableNameForClass(Class<?> theClass, GenerationContext context)

INTERNAL getVariableNameForClass(): Answer the name mapped to the specified class.

public boolean
public boolean
public boolean
hasParameters()

INTERNAL Returns true if the query has at least one parameter.

public boolean
isDeclaredInOuterScope(String variable)

INTERNAL Returns true if the specified string denotes a variable declared in an outer scope.

public boolean
isRangeVariable(String variable)

INTERNAL Returns true if the specified string denotes a range variable.

public boolean
isVariable(String variable)

INTERNAL Returns true if the specified string denotes a variable.

public void
leaveScope()

INTERNAL Leaves the current scope.

public Node
pathForVariable(String variable)

INTERNAL Returns the path if the specified string denotes a join or collection member variable.

public void
registerFetchJoin(String variableName, Node node)

Associate the given variableName with the given node representing a JOIN FETCH node.

public void
registerJoinVariable(String variable, Node path, int line, int column)

INTERNAL Associate the given path with the given variable.

public void
registerOuterScopeVariable(String variable)

INTERNAL Adds the specified variable to the set of outer scope variables.

public void
registerSchema(String variable, String schema, int line, int column)

INTERNAL Associate the given schema with the given variable.

public void
resetOuterScopeVariables()

INTERNAL Resets the set of outer scope variables.

public void
resetOuterScopeVariables(Set<String> variables)

INTERNAL Resets the set of outer scope variables.

public String
schemaForVariable(String variable)

INTERNAL Returns the abstract schema name if the specified string denotes a range variable.

public void
public void
setScopeOfVariable(String variable)

INTERNAL Sets the scope of the specified variable to the current scope.

public void
setTypeHelper(TypeHelper typeHelper)

INTERNAL Stores the specified type helper in this context.

public void
unregisterVariable(String variable)

INTERNAL

public void
usedVariable(String variable)

Mark the specified variable as used if it is declared in the current scope.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseVariableback to summary
private String baseVariable
currentScopeback to summary
private int currentScope
fetchJoinsback to summary
private Map<String, List<Node>> fetchJoins
nodeFactoryback to summary
private NodeFactory nodeFactory
outerScopeVariablesback to summary
private Set<String> outerScopeVariables
parameterNamesback to summary
private List<String> parameterNames
parameterTypesback to summary
private Map<String, Object> parameterTypes
queryInfoback to summary
private String queryInfo
typeHelperback to summary
private TypeHelper typeHelper
variableDeclsback to summary
private Map<String, ParseTreeContext.VariableDecl> variableDecls

Constructor Detail

ParseTreeContextback to summary
public ParseTreeContext(NodeFactory nodeFactory, String queryInfo)

INTERNAL Return a new initialized ParseTreeContext

Method Detail

addParameterback to summary
public void addParameter(String parameterName)

INTERNAL Add a parameter.

classForSchemaNameback to summary
public Class<?> classForSchemaName(String schemaName, GenerationContext context)

INTERNAL Answer the class associated with the provided schema name

defineParameterTypeback to summary
public void defineParameterType(String parameterName, Object parameterType, int line, int column)

INTERNAL Defines the type of the parameter with the specified name.

enterScopeback to summary
public void enterScope()

INTERNAL Enters a new scope. This initializes the set of outer scope variables.

getBaseVariableback to summary
public String getBaseVariable()
getFetchJoinsback to summary
public List<Node> getFetchJoins(String variableName)

Returns a list of FETCH JOIN nodes for the specified attached to the specified variable.

getNodeFactoryback to summary
public NodeFactory getNodeFactory()
getOuterScopeVariablesback to summary
public Set<String> getOuterScopeVariables()

INTERNAL Returns the set of outer scope variables.

getParameterNamesback to summary
public List<String> getParameterNames()

INTERNAL Return the parameter names.

getParameterTypeback to summary
public Object getParameterType(String parameter)

INTERNAL Return the type of the specified parameter.

getQueryInfoback to summary
public String getQueryInfo()
getTypeHelperback to summary
public TypeHelper getTypeHelper()

INTERNAL Returns the type helper stored in this context.

getUnusedVariablesback to summary
public Set<String> getUnusedVariables()

Returns s set of variables that are declared in the current scope, but not used in the query.

getVariableNameForClassback to summary
public String getVariableNameForClass(Class<?> theClass, GenerationContext context)

INTERNAL getVariableNameForClass(): Answer the name mapped to the specified class. Answer null if none found. SELECT OBJECT (emp) FROM Employee emp getVariableNameForClass(Employee.class) => "emp"

hasMoreThanOneAliasInFromback to summary
public boolean hasMoreThanOneAliasInFrom()
hasMoreThanOneVariablePerTypeback to summary
public boolean hasMoreThanOneVariablePerType()
hasParametersback to summary
public boolean hasParameters()

INTERNAL Returns true if the query has at least one parameter.

isDeclaredInOuterScopeback to summary
public boolean isDeclaredInOuterScope(String variable)

INTERNAL Returns true if the specified string denotes a variable declared in an outer scope.

isRangeVariableback to summary
public boolean isRangeVariable(String variable)

INTERNAL Returns true if the specified string denotes a range variable.

isVariableback to summary
public boolean isVariable(String variable)

INTERNAL Returns true if the specified string denotes a variable.

leaveScopeback to summary
public void leaveScope()

INTERNAL Leaves the current scope.

pathForVariableback to summary
public Node pathForVariable(String variable)

INTERNAL Returns the path if the specified string denotes a join or collection member variable.

registerFetchJoinback to summary
public void registerFetchJoin(String variableName, Node node)

Associate the given variableName with the given node representing a JOIN FETCH node.

registerJoinVariableback to summary
public void registerJoinVariable(String variable, Node path, int line, int column)

INTERNAL Associate the given path with the given variable.

registerOuterScopeVariableback to summary
public void registerOuterScopeVariable(String variable)

INTERNAL Adds the specified variable to the set of outer scope variables.

registerSchemaback to summary
public void registerSchema(String variable, String schema, int line, int column)

INTERNAL Associate the given schema with the given variable.

resetOuterScopeVariablesback to summary
public void resetOuterScopeVariables()

INTERNAL Resets the set of outer scope variables.

resetOuterScopeVariablesback to summary
public void resetOuterScopeVariables(Set<String> variables)

INTERNAL Resets the set of outer scope variables.

schemaForVariableback to summary
public String schemaForVariable(String variable)

INTERNAL Returns the abstract schema name if the specified string denotes a range variable.

setBaseVariableback to summary
public void setBaseVariable(String variable)
setScopeOfVariableback to summary
public void setScopeOfVariable(String variable)

INTERNAL Sets the scope of the specified variable to the current scope.

setTypeHelperback to summary
public void setTypeHelper(TypeHelper typeHelper)

INTERNAL Stores the specified type helper in this context.

unregisterVariableback to summary
public void unregisterVariable(String variable)

INTERNAL

usedVariableback to summary
public void usedVariable(String variable)

Mark the specified variable as used if it is declared in the current scope.

org.eclipse.persistence.internal.jpa.parsing back to summary

pack-priv Class ParseTreeContext.VariableDecl

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.persistence.internal.jpa.parsing.ParseTreeContext.VariableDecl

INTERNAL Class defining the type of the values the variableDecls map. It holds the following values: variable - the name of the variable isRangeVariable - true if the variable is declared as range variable schema - the abstract for a range variable path - the path for join or collection member variable scope - the scope of the variable used - true if the variable is used in any of the clauses

Field Summary

Modifier and TypeField and Description
public final boolean
public final Node
public final String
public int
public boolean
public final String

Constructor Summary

AccessConstructor and Description
public
VariableDecl(String variable, String schema)

public
VariableDecl(String variable, Node path)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

isRangeVariableback to summary
public final boolean isRangeVariable
pathback to summary
public final Node path
schemaback to summary
public final String schema
scopeback to summary
public int scope
usedback to summary
public boolean used
variableback to summary
public final String variable

Constructor Detail

VariableDeclback to summary
public VariableDecl(String variable, String schema)
VariableDeclback to summary
public VariableDecl(String variable, Node path)