koala.dynamicjava.tree
Class FieldDeclaration

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

public class FieldDeclaration
extends Declaration

This class represents field declarations in an AST

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

Constructor Summary
FieldDeclaration(ModifierSet mods, TypeName type, java.lang.String name, Expression init)
          Creates a new field declaration
FieldDeclaration(ModifierSet mods, TypeName type, java.lang.String name, Expression init, SourceInfo si)
          Creates a new field declaration
 
Method Summary
<T> T
acceptVisitor(Visitor<T> visitor)
          Allows a visitor to traverse the tree
 Expression getInitializer()
          Returns the initializer for this field
 java.lang.String getName()
          Returns the name of this field
 TypeName getType()
          Gets the declared type for this field
 void setInitializer(Expression e)
          Sets the initializer
 void setName(java.lang.String s)
          Sets the field'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

FieldDeclaration

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

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

FieldDeclaration

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

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

getType

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


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 field


setName

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

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

getInitializer

public Expression getInitializer()
Returns the initializer for this field


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