koala.dynamicjava.tree
Class MethodDeclaration

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

public class MethodDeclaration
extends Declaration

This class represents method declarations in an AST

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

Constructor Summary
MethodDeclaration(ModifierSet mods, Option<java.util.List<TypeParameter>> tparams, TypeName type, java.lang.String name, java.util.List<FormalParameter> params, java.util.List<? extends ReferenceTypeName> excepts, BlockStatement body)
          Creates a new method declaration
MethodDeclaration(ModifierSet mods, Option<java.util.List<TypeParameter>> tparams, TypeName type, java.lang.String name, java.util.List<FormalParameter> params, java.util.List<? extends ReferenceTypeName> excepts, BlockStatement body, SourceInfo si)
          Creates a new method declaration
MethodDeclaration(ModifierSet mods, TypeName type, java.lang.String name, java.util.List<FormalParameter> params, java.util.List<? extends ReferenceTypeName> excepts, BlockStatement body)
          Creates a new method declaration
MethodDeclaration(ModifierSet mods, TypeName type, java.lang.String name, java.util.List<FormalParameter> params, java.util.List<? extends ReferenceTypeName> excepts, BlockStatement body, SourceInfo si)
          Creates a new method declaration
 
Method Summary
<T> T
acceptVisitor(Visitor<T> visitor)
          Allows a visitor to traverse the tree
 BlockStatement getBody()
          Returns the body of the method, null if the method is abstract
 java.util.List<? extends ReferenceTypeName> getExceptions()
          Returns the list of the exception thrown by this method
 java.lang.String getName()
          Returns the name of this method
 java.util.List<FormalParameter> getParameters()
          Returns the parameters list
 TypeName getReturnType()
          Gets the return type of this method
 Option<java.util.List<TypeParameter>> getTypeParams()
           
 void setBody(BlockStatement bs)
          Sets the body
 void setExceptions(java.util.List<? extends ReferenceTypeName> l)
          Sets the exceptions list
 void setName(java.lang.String s)
          Sets the method's name
 void setParameters(java.util.List<FormalParameter> l)
          Sets the parameters list
 void setReturnType(TypeName t)
          Sets the return type of this method
 void setTypeArgs(java.util.List<TypeParameter> tparams)
           
 void setTypeArgs(Option<java.util.List<TypeParameter>> tparams)
           
 java.lang.String toString()
          Implementation of toString for use in unit testing
 java.lang.String toStringHelper()
           
 
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

MethodDeclaration

public MethodDeclaration(ModifierSet mods,
                         TypeName type,
                         java.lang.String name,
                         java.util.List<FormalParameter> params,
                         java.util.List<? extends ReferenceTypeName> excepts,
                         BlockStatement body)
Creates a new method declaration

Parameters:
mods - the modifiers
type - the return type of this method
name - the name of the method to declare
params - the parameters list
excepts - the exception list
body - the body statement
Throws:
java.lang.IllegalArgumentException - if name is null or type is null or params is null or excepts is null

MethodDeclaration

public MethodDeclaration(ModifierSet mods,
                         Option<java.util.List<TypeParameter>> tparams,
                         TypeName type,
                         java.lang.String name,
                         java.util.List<FormalParameter> params,
                         java.util.List<? extends ReferenceTypeName> excepts,
                         BlockStatement body)
Creates a new method declaration

Parameters:
mods - the modifiers
tparams - type parameters
type - the return type of this method
name - the name of the method to declare
params - the parameters list
excepts - the exception list
body - the body statement
Throws:
java.lang.IllegalArgumentException - if name is null or type is null or params is null or excepts is null

MethodDeclaration

public MethodDeclaration(ModifierSet mods,
                         TypeName type,
                         java.lang.String name,
                         java.util.List<FormalParameter> params,
                         java.util.List<? extends ReferenceTypeName> excepts,
                         BlockStatement body,
                         SourceInfo si)
Creates a new method declaration

Parameters:
mods - the modifiers
type - the return type of this method
name - the name of the method to declare
params - the parameters list
excepts - the exception list
body - the body statement
Throws:
java.lang.IllegalArgumentException - if name is null or type is null or params is null or excepts is null

MethodDeclaration

public MethodDeclaration(ModifierSet mods,
                         Option<java.util.List<TypeParameter>> tparams,
                         TypeName type,
                         java.lang.String name,
                         java.util.List<FormalParameter> params,
                         java.util.List<? extends ReferenceTypeName> excepts,
                         BlockStatement body,
                         SourceInfo si)
Creates a new method declaration

Parameters:
mods - the modifiers
tparams - type parameters
type - the return type of this method
name - the name of the method to declare
params - the parameters list
excepts - the exception list
body - the body statement
Throws:
java.lang.IllegalArgumentException - if name is null or type is null or params is null or excepts is null
Method Detail

getTypeParams

public Option<java.util.List<TypeParameter>> getTypeParams()

setTypeArgs

public void setTypeArgs(java.util.List<TypeParameter> tparams)

setTypeArgs

public void setTypeArgs(Option<java.util.List<TypeParameter>> tparams)

getReturnType

public TypeName getReturnType()
Gets the return type of this method


setReturnType

public void setReturnType(TypeName t)
Sets the return type of this method

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

getName

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


setName

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

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

getParameters

public java.util.List<FormalParameter> getParameters()
Returns the parameters list


setParameters

public void setParameters(java.util.List<FormalParameter> l)
Sets the parameters list

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

getExceptions

public java.util.List<? extends ReferenceTypeName> getExceptions()
Returns the list of the exception thrown by this method

Returns:
a list of string

setExceptions

public void setExceptions(java.util.List<? extends ReferenceTypeName> l)
Sets the exceptions list

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

getBody

public BlockStatement getBody()
Returns the body of the method, null if the method is abstract


setBody

public void setBody(BlockStatement bs)
Sets the body


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

toStringHelper

public java.lang.String toStringHelper()