org.codehaus.groovy.ast.expr

## Class DeclarationExpression

- java.lang.Object
- - org.codehaus.groovy.ast.ASTNode
  - - org.codehaus.groovy.ast.AnnotatedNode
    - - org.codehaus.groovy.ast.expr.Expression
      - - org.codehaus.groovy.ast.expr.BinaryExpression
        - - org.codehaus.groovy.ast.expr.DeclarationExpression

    public class DeclarationExpression
    extends BinaryExpression

Represents a local variable name declaration, an expression like "def foo" or with type "String foo".

Version:
  $Revision: 21304 $
Author:
  Jochen Theodorou

### Constructor Summary

Constructors
Constructor and Description
`DeclarationExpression(Expression left, Token operation, Expression right)`
`DeclarationExpression(VariableExpression left, Token operation, Expression right)`

### Method Summary

Methods
`VariableExpression` `getVariableExpression()`
`boolean` `isMultipleAssignmentDeclaration()` This method tells you if this declaration is a multiple assignment declaration, which has the form "def (x, y) = ..." in Groovy.
`void` `setLeftExpression(Expression leftExpression)`
`void` `setRightExpression(Expression rightExpression)`
`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.BinaryExpression

`getLeftExpression, getOperation, getRightExpression, getText, newAssignmentExpression, newInitializationExpression, toString`

### Methods inherited from class org.codehaus.groovy.ast.expr.Expression

`getType, setType, 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`

### Constructor Detail

#### DeclarationExpression

    public DeclarationExpression(VariableExpression left,
                         Token operation,
                         Expression right)

#### DeclarationExpression

    public DeclarationExpression(Expression left,
                         Token operation,
                         Expression right)

### Method Detail

#### visit

    public void visit(GroovyCodeVisitor visitor)

Overrides:
  `visit` in class `BinaryExpression`

#### getVariableExpression

    public VariableExpression getVariableExpression()

#### setLeftExpression

    public void setLeftExpression(Expression leftExpression)

Overrides:
  `setLeftExpression` in class `BinaryExpression`

#### setRightExpression

    public void setRightExpression(Expression rightExpression)

Overrides:
  `setRightExpression` in class `BinaryExpression`

#### transformExpression

    public Expression transformExpression(ExpressionTransformer transformer)

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

Overrides:
  `transformExpression` in class `BinaryExpression`

#### isMultipleAssignmentDeclaration

    public boolean isMultipleAssignmentDeclaration()

This method tells you if this declaration is a multiple assignment declaration, which has the form "def (x, y) = ..." in Groovy. If this method returns true, then the left hand side is an ArgumentListExpression. Do not call "getVariableExpression()" on this object if this method returns true, instead use "getLeftExpression()".

Returns:
  true if this declaration is a multiple assignment declaration, which means the left hand side is an ArgumentListExpression.