koala.dynamicjava.tree
Class VariableDeclaration

java.lang.Object
  extended by koala.dynamicjava.tree.Node
      extended by koala.dynamicjava.tree.Declaration
          extended by koala.dynamicjava.tree.VariableDeclaration
All Implemented Interfaces:
SourceInfo.Wrapper

public class VariableDeclaration
extends Declaration

This class represents variable declarations in an AST

Version:
1.0 - 1999/05/11
Author:
Stephane Hillion

Constructor Summary
VariableDeclaration(ModifierSet mods, TypeName type, java.lang.String name, Expression init)
          Creates a new variable declaration
VariableDeclaration(ModifierSet mods, TypeName type, java.lang.String name, Expression init, SourceInfo si)
          Creates a new variable declaration
 
Method Summary
<T> T
acceptVisitor(Visitor<T> visitor)
          Allows a visitor to traverse the tree
 Expression getInitializer()
          Returns the initializer for this variable
 java.lang.String getName()
          Returns the name of this variable
 TypeName getType()
          Gets the declared type for this variable
 void setInitializer(Expression e)
          Sets the initializer
 void setName(java.lang.String s)
          Sets the variable's name
 void setType(TypeName t)
          Sets the type of this field
 java.lang.String toString()
          Implementation of toString for use in unit testing
 
Methods inherited from class koala.dynamicjava.tree.Declaration
getModifiers, setModifiers
 
Methods inherited from class koala.dynamicjava.tree.Node
archiveProperties, getProperties, getProperty, getSourceInfo, hasProperty, setProperty, setSourceInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VariableDeclaration

public VariableDeclaration(ModifierSet mods,
                           TypeName type,
                           java.lang.String name,
                           Expression init)
Creates a new variable declaration

Parameters:
mods - the modifiers
type - the type of this variable
name - the name of this variable
init - the initializer
Throws:
java.lang.IllegalArgumentException - if name is null or type is null

VariableDeclaration

public VariableDeclaration(ModifierSet mods,
                           TypeName type,
                           java.lang.String name,
                           Expression init,
                           SourceInfo si)
Creates a new variable declaration

Parameters:
mods - the modifiers
type - the type of this variable
name - the name of this variable
init - the initializer
Throws:
java.lang.IllegalArgumentException - if name is null or type is null
Method Detail

getType

public TypeName getType()
Gets the declared type for this variable


setType

public void setType(TypeName t)
Sets the type of this field

Throws:
java.lang.IllegalArgumentException - if t is null

getName

public java.lang.String getName()
Returns the name of this variable


setName

public void setName(java.lang.String s)
Sets the variable's name

Throws:
java.lang.IllegalArgumentException - if s is null

getInitializer

public Expression getInitializer()
Returns the initializer for this variable


setInitializer

public void setInitializer(Expression e)
Sets the initializer


acceptVisitor

public <T> T acceptVisitor(Visitor<T> visitor)
Allows a visitor to traverse the tree

Specified by:
acceptVisitor in class Node
Parameters:
visitor - the visitor to accept

toString

public java.lang.String toString()
Implementation of toString for use in unit testing

Overrides:
toString in class java.lang.Object