|
Groovy Documentation | |||||||
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(java.lang.String variable, ClassNode type)
|
|
VariableExpression(java.lang.String variable)
|
|
VariableExpression(Variable variable)
|
Method Summary | |
---|---|
Variable
|
getAccessedVariable()
|
Expression
|
getInitialExpression()
|
int
|
getModifiers()
|
java.lang.String
|
getName()
|
ClassNode
|
getOriginType()
Returns the type which was used when this variable expression was created. |
java.lang.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. |
java.lang.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 java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
public static final VariableExpression SUPER_EXPRESSION
public static final VariableExpression THIS_EXPRESSION
Constructor Detail |
---|
public VariableExpression(java.lang.String variable, ClassNode type)
public VariableExpression(java.lang.String variable)
public VariableExpression(Variable variable)
Method Detail |
---|
public Variable getAccessedVariable()
public Expression getInitialExpression()
public int getModifiers()
public java.lang.String getName()
public ClassNode getOriginType()
public java.lang.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 java.lang.String toString()
public Expression transformExpression(ExpressionTransformer transformer)
public void visit(GroovyCodeVisitor visitor)
Groovy Documentation