|
Groovy 2.2.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.ast.ASTNode org.codehaus.groovy.ast.AnnotatedNode org.codehaus.groovy.ast.expr.Expression org.codehaus.groovy.ast.expr.VariableExpression
public class VariableExpression extends Expression
Represents a local variable name, the simplest form of expression. e.g. "foo".
Field Summary | |
---|---|
static VariableExpression |
SUPER_EXPRESSION
|
static VariableExpression |
THIS_EXPRESSION
|
Constructor Summary | |
VariableExpression(String variable, ClassNode type)
|
|
VariableExpression(String variable)
|
|
VariableExpression(Variable variable)
|
Method Summary | |
---|---|
Variable
|
getAccessedVariable()
|
Expression
|
getInitialExpression()
|
int
|
getModifiers()
|
String
|
getName()
|
ClassNode
|
getOriginType()
Returns the type which was used when this variable expression was created. |
String
|
getText()
|
ClassNode
|
getType()
|
boolean
|
hasInitialExpression()
|
boolean
|
isClosureSharedVariable()
Tells if this variable or the accessed variable is used in a closure context, like in the following example : def str = 'Hello' def cl = { println str }The "str" variable is closure shared. |
boolean
|
isDynamicTyped()
|
boolean
|
isInStaticContext()
|
boolean
|
isSuperExpression()
|
boolean
|
isThisExpression()
|
boolean
|
isUseReferenceDirectly()
For internal use only. |
void
|
setAccessedVariable(Variable origin)
|
void
|
setClosureSharedVariable(boolean inClosure)
Use this method to tell if a variable is used in a closure, like in the following example: def str = 'Hello' def cl = { println str }The "str" variable is closure shared. |
void
|
setInStaticContext(boolean inStaticContext)
|
void
|
setModifiers(int modifiers)
|
void
|
setType(ClassNode cn)
Set the type of this variable. |
void
|
setUseReferenceDirectly(boolean useRef)
For internal use only. |
String
|
toString()
|
Expression
|
transformExpression(ExpressionTransformer transformer)
|
void
|
visit(GroovyCodeVisitor visitor)
|
Methods inherited from class Expression | |
---|---|
getType, setType, transformExpression, transformExpressions, transformExpressions |
Methods inherited from class AnnotatedNode | |
---|---|
addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail |
---|
public static final VariableExpression SUPER_EXPRESSION
public static final VariableExpression THIS_EXPRESSION
Constructor Detail |
---|
public VariableExpression(String variable, ClassNode type)
public VariableExpression(String variable)
public VariableExpression(Variable variable)
Method Detail |
---|
public Variable getAccessedVariable()
public Expression getInitialExpression()
public int getModifiers()
public String getName()
public ClassNode getOriginType()
public String getText()
public ClassNode getType()
public boolean hasInitialExpression()
public boolean isClosureSharedVariable()
def str = 'Hello' def cl = { println str }The "str" variable is closure shared.
public boolean isDynamicTyped()
public boolean isInStaticContext()
public boolean isSuperExpression()
public boolean isThisExpression()
public boolean isUseReferenceDirectly()
public void setAccessedVariable(Variable origin)
public void setClosureSharedVariable(boolean inClosure)
def str = 'Hello' def cl = { println str }The "str" variable is closure shared. The variable expression inside the closure references an accessed variable "str" which must have the closure shared flag set.
inClosure
- tells if this variable is later referenced in a closure
public void setInStaticContext(boolean inStaticContext)
public void setModifiers(int modifiers)
public void setType(ClassNode cn)
cn
- the type to be set on this variable
public void setUseReferenceDirectly(boolean useRef)
public String toString()
public Expression transformExpression(ExpressionTransformer transformer)
public void visit(GroovyCodeVisitor visitor)
Copyright © 2003-2013 The Codehaus. All rights reserved.