Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.ast.expr
Class VariableExpression

    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

All Implemented Interfaces:
  Variable

    public class VariableExpression
    extends Expression
    implements Variable

Represents a local variable name, the simplest form of expression. e.g. "foo".

Version:
  $Revision: 17968 $
Author:
  James Strachan

Field Summary
Modifier and Type | Field and Description
--- | ---
`static VariableExpression` | `SUPER_EXPRESSION`
`static VariableExpression` | `THIS_EXPRESSION`

Constructor Summary
Constructor and Description
`VariableExpression(String variable)`
`VariableExpression(String variable, ClassNode type)`
`VariableExpression(Variable variable)`

Method Summary
Modifier and Type | Method and Description
--- | ---
`Variable` | `getAccessedVariable()`
`Expression` | `getInitialExpression()` expression used to initialize the variable or null of there is no initialization.
`String` | `getName()` the name of the variable
`ClassNode` | `getOriginType()` the type before wrapping primitives type of the variable
`String` | `getText()`
`ClassNode` | `getType()` the type of the variable
`boolean` | `hasInitialExpression()` returns true if there is an initialization expression
`boolean` | `isClosureSharedVariable()`
`boolean` | `isDynamicTyped()`
`boolean` | `isInStaticContext()` returns true if this variable is used in a static context.
`boolean` | `isSuperExpression()`
`boolean` | `isThisExpression()`
`boolean` | `isUseReferenceDirectly()`
`void` | `setAccessedVariable(Variable origin)`
`void` | `setClosureSharedVariable(boolean inClosure)`
`void` | `setInStaticContext(boolean inStaticContext)`
`void` | `setType(ClassNode cn)`
`void` | `setUseReferenceDirectly(boolean useRef)`
`String` | `toString()`
`Expression` | `transformExpression(ExpressionTransformer transformer)` Return a copy of the expression calling the transformer on any nested expressions
`void` | `visit(GroovyCodeVisitor visitor)`

Methods inherited from class org.codehaus.groovy.ast.expr.Expression
`transformExpressions, transformExpressions`

Methods inherited from class org.codehaus.groovy.ast.AnnotatedNode
`addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`

Methods inherited from class org.codehaus.groovy.ast.ASTNode
`copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### THIS_EXPRESSION

    public static final VariableExpression THIS_EXPRESSION

### SUPER_EXPRESSION

    public static final VariableExpression SUPER_EXPRESSION

Constructor Detail

### VariableExpression

    public VariableExpression(String variable,
                              ClassNode type)

### VariableExpression

    public VariableExpression(String variable)

### VariableExpression

    public VariableExpression(Variable variable)

Method Detail

### getAccessedVariable

    public Variable getAccessedVariable()

### setAccessedVariable

    public void setAccessedVariable(Variable origin)

### visit

    public void visit(GroovyCodeVisitor visitor)

  Overrides:
    `visit` in class `ASTNode`

### transformExpression

    public Expression transformExpression(ExpressionTransformer transformer)

  Description copied from class: `Expression`
  Return a copy of the expression calling the transformer on any nested expressions

  Specified by:
    `transformExpression` in class `Expression`

### getText

    public String getText()

  Overrides:
    `getText` in class `ASTNode`

### getName

    public String getName()

  Description copied from interface: `Variable`
  the name of the variable

  Specified by:
    `getName` in interface `Variable`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### getInitialExpression

    public Expression getInitialExpression()

  Description copied from interface: `Variable`
  expression used to initialize the variable or null of there is no initialization.

  Specified by:
    `getInitialExpression` in interface `Variable`

### hasInitialExpression

    public boolean hasInitialExpression()

  Description copied from interface: `Variable`
  returns true if there is an initialization expression

  Specified by:
    `hasInitialExpression` in interface `Variable`

### isInStaticContext

    public boolean isInStaticContext()

  Description copied from interface: `Variable`
  returns true if this variable is used in a static context. A static context is any static initializer block, when this variable is declared as static or when this variable is used in a static method

  Specified by:
    `isInStaticContext` in interface `Variable`

### setInStaticContext

    public void setInStaticContext(boolean inStaticContext)

### setType

    public void setType(ClassNode cn)

  Overrides:
    `setType` in class `Expression`

### isDynamicTyped

    public boolean isDynamicTyped()

  Specified by:
    `isDynamicTyped` in interface `Variable`

### isClosureSharedVariable

    public boolean isClosureSharedVariable()

  Specified by:
    `isClosureSharedVariable` in interface `Variable`

### setClosureSharedVariable

    public void setClosureSharedVariable(boolean inClosure)

  Specified by:
    `setClosureSharedVariable` in interface `Variable`

### setUseReferenceDirectly

    public void setUseReferenceDirectly(boolean useRef)

### isUseReferenceDirectly

    public boolean isUseReferenceDirectly()

### getType

    public ClassNode getType()

  Description copied from interface: `Variable`
  the type of the variable

  Specified by:
    `getType` in interface `Variable`
  Overrides:
    `getType` in class `Expression`

### getOriginType

    public ClassNode getOriginType()

  Description copied from interface: `Variable`
  the type before wrapping primitives type of the variable

  Specified by:
    `getOriginType` in interface `Variable`

### isThisExpression

    public boolean isThisExpression()

### isSuperExpression

    public boolean isSuperExpression()

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2003-2010 The Codehaus. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD