Class ParseTreeContext
- java.lang.Object
-
- org.eclipse.persistence.internal.jpa.parsing.ParseTreeContext
-
public class ParseTreeContext extends java.lang.ObjectINTERNALPurpose: The ParseTreeContext holds and manages context information for the parse tree for validation.
Responsibilities:
- Associate schema names with variables
- Associate identifier with nodes
- Answer an alias for a variable name
- Answer a class for a variable name
- Answer a class loader
- Answer true if there is a class for a variable name
- Answer a node for a given identifier
- Print the context on a string
- Since:
- TopLink 4.0
- Author:
- Jon Driscoll and Joel Lucuik
- See Also:
ParseTree
-
-
Constructor Summary
Constructors Constructor Description ParseTreeContext(NodeFactory nodeFactory, java.lang.String queryInfo)INTERNAL Return a new initialized ParseTreeContext
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(java.lang.String parameterName)INTERNAL Add a parameter.java.lang.ClassclassForSchemaName(java.lang.String schemaName, GenerationContext context)INTERNAL Answer the class associated with the provided schema namevoiddefineParameterType(java.lang.String parameterName, java.lang.Object parameterType, int line, int column)INTERNAL Defines the type of the parameter with the specified name.voidenterScope()INTERNAL Enters a new scope.java.lang.StringgetBaseVariable()java.util.ListgetFetchJoins(java.lang.String variableName)Returns a list of FETCH JOIN nodes for the specified attached to the specified variable.NodeFactorygetNodeFactory()java.util.SetgetOuterScopeVariables()INTERNAL Returns the set of outer scope variables.java.util.ListgetParameterNames()INTERNAL Return the parameter names.java.lang.ObjectgetParameterType(java.lang.String parameter)INTERNAL Return the type of the specified parameter.java.lang.StringgetQueryInfo()TypeHelpergetTypeHelper()INTERNAL Returns the type helper stored in this context.java.util.SetgetUnusedVariables()Returns s set of variables that are declared in the current scope, but not used in the query.java.lang.StringgetVariableNameForClass(java.lang.Class theClass, GenerationContext context)INTERNAL getVariableNameForClass(): Answer the name mapped to the specified class.booleanhasMoreThanOneAliasInFrom()booleanhasMoreThanOneVariablePerType()booleanhasParameters()INTERNAL Returns true if the query has at least one parameter.booleanisDeclaredInOuterScope(java.lang.String variable)INTERNAL Returns true if the specified string denotes a variable declared in an outer scope.booleanisRangeVariable(java.lang.String variable)booleanisVariable(java.lang.String variable)INTERNAL Returns true if the specified string denotes a variable.voidleaveScope()INTERNAL Leaves the current scope.NodepathForVariable(java.lang.String variable)INTERNAL Returns the path if the specified string denotes a join or collection member variable.voidregisterFetchJoin(java.lang.String variableName, Node node)Associate the given variableName with the given node representing a JOIN FETCH node.voidregisterJoinVariable(java.lang.String variable, Node path, int line, int column)INTERNAL Associate the given path with the given variable.voidregisterOuterScopeVariable(java.lang.String variable)INTERNAL Adds the specified variable to the set of outer scope variables.voidregisterSchema(java.lang.String variable, java.lang.String schema, int line, int column)INTERNAL Associate the given schema with the given variable.voidresetOuterScopeVariables()INTERNAL Resets the set of outer scope variables.voidresetOuterScopeVariables(java.util.Set variables)INTERNAL Resets the set of outer scope variables.java.lang.StringschemaForVariable(java.lang.String variable)INTERNAL Returns the abstract schema name if the specified string denotes a range variable.voidsetBaseVariable(java.lang.String variable)voidsetScopeOfVariable(java.lang.String variable)INTERNAL Sets the scope of the specified variable to the current scope.voidsetTypeHelper(TypeHelper typeHelper)INTERNAL Stores the specified type helper in this context.voidunregisterVariable(java.lang.String variable)INTERNALvoidusedVariable(java.lang.String variable)Mark the specified variable as used if it is declared in the current scope.
-
-
-
Constructor Detail
-
ParseTreeContext
public ParseTreeContext(NodeFactory nodeFactory, java.lang.String queryInfo)
INTERNAL Return a new initialized ParseTreeContext
-
-
Method Detail
-
registerSchema
public void registerSchema(java.lang.String variable, java.lang.String schema, int line, int column)INTERNAL Associate the given schema with the given variable.
-
registerJoinVariable
public void registerJoinVariable(java.lang.String variable, Node path, int line, int column)INTERNAL Associate the given path with the given variable.
-
unregisterVariable
public void unregisterVariable(java.lang.String variable)
INTERNAL
-
isVariable
public boolean isVariable(java.lang.String variable)
INTERNAL Returns true if the specified string denotes a variable.
-
isRangeVariable
public boolean isRangeVariable(java.lang.String variable)
-
schemaForVariable
public java.lang.String schemaForVariable(java.lang.String variable)
INTERNAL Returns the abstract schema name if the specified string denotes a range variable.
-
classForSchemaName
public java.lang.Class classForSchemaName(java.lang.String schemaName, GenerationContext context)INTERNAL Answer the class associated with the provided schema name
-
getVariableNameForClass
public java.lang.String getVariableNameForClass(java.lang.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"
-
pathForVariable
public Node pathForVariable(java.lang.String variable)
INTERNAL Returns the path if the specified string denotes a join or collection member variable.
-
getBaseVariable
public java.lang.String getBaseVariable()
-
setBaseVariable
public void setBaseVariable(java.lang.String variable)
-
getNodeFactory
public NodeFactory getNodeFactory()
-
getQueryInfo
public java.lang.String getQueryInfo()
-
isDeclaredInOuterScope
public boolean isDeclaredInOuterScope(java.lang.String variable)
INTERNAL Returns true if the specified string denotes a variable declared in an outer scope.
-
setScopeOfVariable
public void setScopeOfVariable(java.lang.String variable)
INTERNAL Sets the scope of the specified variable to the current scope.
-
enterScope
public void enterScope()
INTERNAL Enters a new scope. This initializes the set of outer scope variables.
-
leaveScope
public void leaveScope()
INTERNAL Leaves the current scope.
-
registerOuterScopeVariable
public void registerOuterScopeVariable(java.lang.String variable)
INTERNAL Adds the specified variable to the set of outer scope variables.
-
getOuterScopeVariables
public java.util.Set getOuterScopeVariables()
INTERNAL Returns the set of outer scope variables.
-
resetOuterScopeVariables
public void resetOuterScopeVariables()
INTERNAL Resets the set of outer scope variables.
-
resetOuterScopeVariables
public void resetOuterScopeVariables(java.util.Set variables)
INTERNAL Resets the set of outer scope variables.
-
registerFetchJoin
public void registerFetchJoin(java.lang.String variableName, Node node)Associate the given variableName with the given node representing a JOIN FETCH node.
-
getFetchJoins
public java.util.List getFetchJoins(java.lang.String variableName)
Returns a list of FETCH JOIN nodes for the specified attached to the specified variable.
-
usedVariable
public void usedVariable(java.lang.String variable)
Mark the specified variable as used if it is declared in the current scope.
-
getUnusedVariables
public java.util.Set getUnusedVariables()
Returns s set of variables that are declared in the current scope, but not used in the query.
-
hasMoreThanOneVariablePerType
public boolean hasMoreThanOneVariablePerType()
-
hasMoreThanOneAliasInFrom
public boolean hasMoreThanOneAliasInFrom()
-
getTypeHelper
public TypeHelper getTypeHelper()
INTERNAL Returns the type helper stored in this context.
-
setTypeHelper
public void setTypeHelper(TypeHelper typeHelper)
INTERNAL Stores the specified type helper in this context.
-
addParameter
public void addParameter(java.lang.String parameterName)
INTERNAL Add a parameter.
-
defineParameterType
public void defineParameterType(java.lang.String parameterName, java.lang.Object parameterType, int line, int column)INTERNAL Defines the type of the parameter with the specified name.
-
hasParameters
public boolean hasParameters()
INTERNAL Returns true if the query has at least one parameter.
-
getParameterType
public java.lang.Object getParameterType(java.lang.String parameter)
INTERNAL Return the type of the specified parameter.
-
getParameterNames
public java.util.List getParameterNames()
INTERNAL Return the parameter names.
-
-