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

public Class VariableNode

extends Node
implements AliasableNode
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.internal.jpa.parsing.AliasableNode
Imports
java.util.ArrayList, .Iterator, .List, org.eclipse.persistence.exceptions.JPQLException, org.eclipse.persistence.expressions.Expression, .ExpressionBuilder, org.eclipse.persistence.internal.expressions.ConstantExpression, org.eclipse.persistence.queries.ObjectLevelReadQuery, .ReportQuery

INTERNAL

Purpose: The node that represents typed variables, local variables, remote variables and TYPE constants.

Author
Jon Driscoll and Joel Lucuik
Since
TopLink 4.0

Field Summary

Modifier and TypeField and Description
private String
private Object
classConstant

if this represents a type constant, this value will be populated by validate

private String
Inherited from org.eclipse.persistence.internal.jpa.parsing.Node:
aliasleftrightshouldGenerateExpression

Constructor Summary

AccessConstructor and Description
public
VariableNode()

VariableNode constructor comment.

public
VariableNode(String newVariableName)

Method Summary

Modifier and TypeMethod and Description
private void
addAttributeWithFetchJoins(ReportQuery reportQuery, Expression expression, GenerationContext context)

INTERNAL Add the variable as ReportQuery item.

private void
addFetchJoins(ObjectLevelReadQuery theQuery, GenerationContext context)

INTERNAL Check for any JOIN FETCH nodes of the current variable and add them as joined attributes.

public void
applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext generationContext)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.applyToQuery.

INTERNAL Apply this node to the passed query
public Expression
public Expression
generateExpression(GenerationContext generationContext)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.generateExpression.

INTERNAL Generate an expression for the node.
public Expression
public String
getAsString()

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.getAsString.

INTERNAL Get the string representation of this node.
public String
public Node
public Object
public String
public boolean
isAlias(GenerationContext context)

isAlias: Answer true if this variable represents an alias in the FROM clause.

public boolean
public boolean
public boolean
public Node
qualifyAttributeAccess(ParseTreeContext context)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.qualifyAttributeAccess.

INTERNAL This node represent an unqualified field access in the case the method is called and the variableName is not defined as identification variable.
public Class<?>
resolveClass(GenerationContext generationContext)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.resolveClass.

resolveClass: Answer the class which corresponds to my variableName.
public void
setVariableName(String newVariableName)

public String
public void
validate(ParseTreeContext context)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.validate.

INTERNAL Validate node and calculate its type.
Inherited from org.eclipse.persistence.internal.jpa.parsing.Node:
addToExpressionappendExpressiongetAliasgetColumngetLeftgetLinegetRightgetTypehasLefthasRightisAggregateNodeisAttributeNodeisConstructorNodeisCountNodeisDivideNodeisDotNodeisEscapeisLiteralNodeisMapKeyNodeisMinusNodeisMultiplyNodeisNotNodeisParameterNodeisPlusNodeisSubqueryNoderesolveAttributeresolveClassresolveMappingresolveMappingsetAliassetColumnsetLeftsetLinesetRightsetTypetoStringtoStringDisplayNametoStringIndentvalidateParameter

Field Detail

canonicalNameback to summary
private String canonicalName
classConstantback to summary
private Object classConstant

if this represents a type constant, this value will be populated by validate

variableNameback to summary
private String variableName

Constructor Detail

VariableNodeback to summary
public VariableNode()

VariableNode constructor comment.

VariableNodeback to summary
public VariableNode(String newVariableName)

Method Detail

addAttributeWithFetchJoinsback to summary
private void addAttributeWithFetchJoins(ReportQuery reportQuery, Expression expression, GenerationContext context)

INTERNAL Add the variable as ReportQuery item. The method checks for any JOIN FETCH nodes of the current variable and adds them as part of the ReportQuery item.

addFetchJoinsback to summary
private void addFetchJoins(ObjectLevelReadQuery theQuery, GenerationContext context)

INTERNAL Check for any JOIN FETCH nodes of the current variable and add them as joined attributes. This method is called in case of a non ReportQuery instance.

applyToQueryback to summary
public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext generationContext)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.applyToQuery.

INTERNAL Apply this node to the passed query

Annotations
@Override
generateBaseBuilderExpressionback to summary
public Expression generateBaseBuilderExpression(GenerationContext context)
generateExpressionback to summary
public Expression generateExpression(GenerationContext generationContext)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.generateExpression.

Doc from org.eclipse.persistence.internal.jpa.parsing.Node.generateExpression.

INTERNAL Generate an expression for the node. Each subclass will generate a different expression and thus will need to override this method

Annotations
@Override
generateExpressionForAliasback to summary
public Expression generateExpressionForAlias(GenerationContext context)
getAsStringback to summary
public String getAsString()

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.getAsString.

INTERNAL Get the string representation of this node.

Annotations
@Override
getCanonicalVariableNameback to summary
public String getCanonicalVariableName()
getNodeForAliasback to summary
public Node getNodeForAlias(GenerationContext context)
getTypeForMapKeyback to summary
public Object getTypeForMapKey(ParseTreeContext context)
getVariableNameback to summary
public String getVariableName()
isAliasback to summary
public boolean isAlias(GenerationContext context)

isAlias: Answer true if this variable represents an alias in the FROM clause. i.e. "FROM Employee emp" declares "emp" as an alias

isAliasback to summary
public boolean isAlias(ParseTreeContext context)
isAliasableNodeback to summary
public boolean isAliasableNode()

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.isAliasableNode.

Annotations
@Override
isVariableNodeback to summary
public boolean isVariableNode()

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.isVariableNode.

INTERNAL Is this node a VariableNode

Annotations
@Override
qualifyAttributeAccessback to summary
public Node qualifyAttributeAccess(ParseTreeContext context)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.qualifyAttributeAccess.

INTERNAL This node represent an unqualified field access in the case the method is called and the variableName is not defined as identification variable. The method returns a DotNode representing a qualified field access with the base variable as left child node. The right child node is an AttributeNode using the variableName as field name.

Annotations
@Override
resolveClassback to summary
public Class<?> resolveClass(GenerationContext generationContext)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.resolveClass.

resolveClass: Answer the class which corresponds to my variableName. This is the class for an alias, where the variableName is registered to an alias.

Annotations
@Override
setVariableNameback to summary
public void setVariableName(String newVariableName)
toStringback to summary
public String toString(int indent)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.toString.

Annotations
@Override
validateback to summary
public void validate(ParseTreeContext context)

Overrides org.eclipse.persistence.internal.jpa.parsing.Node.validate.

INTERNAL Validate node and calculate its type.

Annotations
@Override