All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class openjava.ptree.MethodDeclaration

java.lang.Object
   |
   +----openjava.ptree.PtreeObject
           |
           +----openjava.ptree.NonLeaf
                   |
                   +----openjava.ptree.MethodDeclaration

public class MethodDeclaration
extends NonLeaf
implements MemberDeclaration
The MethodDeclaration class presents method declaration node of parse tree.

See Also:
Ptree, NonLeaf, FieldDeclaration

Constructor Index

 o MethodDeclaration(ModifierList, TypeSpecifier, Identifier, ParameterList, ClassTypeList, StatementList)
Constructs new MethodDeclaration from its elements.

Method Index

 o getBody()
Gets body of this method.
 o getModifiers()
Gets modifierlist of this method.
 o getName()
Gets name of this method.
 o getParameters()
Gets parameter list of this method.
 o getThrows()
Gets throw type name list of this method.
 o getTypeSpecifier()
Gets type specifier of this method.
 o make(String)
 o setBody(StatementList)
Sets body of this method.
 o setModifiers(ModifierList)
Sets modifierlist of this method.
 o setName(Identifier)
Sets name of this method.
 o setParameters(ParameterList)
Sets parameter list of this method.
 o setThrows(ClassTypeList)
Sets throw type name list of this method.
 o setTypeSpecifier(TypeSpecifier)
Sets type specifier of this method.
 o writeCode()
Writes the code this parse-tree presents for.

Constructors

 o MethodDeclaration
 public MethodDeclaration(ModifierList modiflist,
                          TypeSpecifier typespec,
                          Identifier name,
                          ParameterList params,
                          ClassTypeList throwlist,
                          StatementList block)
Constructs new MethodDeclaration from its elements.

Parameters:
modiflist - modifier list. If it has no modifier list then thes arg is set empty list.
typespec - type specifier
methoddecl - method declarator
throwlist - throw type list. If there is no throws then this arg is set empty list
block - method block. if arg block is null, it means method body with only semi colon such as methods in interface

Methods

 o writeCode
 public void writeCode()
Writes the code this parse-tree presents for.

Overrides:
writeCode in class NonLeaf
 o getModifiers
 public ModifierList getModifiers()
Gets modifierlist of this method.

Returns:
modifier list. Even if there is no modifiers, getModifiers returns empty list
 o setModifiers
 public void setModifiers(ModifierList modifs)
Sets modifierlist of this method.

Parameters:
modifs - modifier list to set
 o getTypeSpecifier
 public TypeSpecifier getTypeSpecifier()
Gets type specifier of this method.

Returns:
type specifier node
 o setTypeSpecifier
 public void setTypeSpecifier(TypeSpecifier tspec)
Sets type specifier of this method.

Parameters:
tspec - type specifier to set
 o getName
 public Identifier getName()
Gets name of this method.

Returns:
method declarator node
 o setName
 public void setName(Identifier name)
Sets name of this method.

Parameters:
name - method's name
 o getParameters
 public ParameterList getParameters()
Gets parameter list of this method. Even if this method has no parameter, this returns an empty list of parameter.

Returns:
method's name
 o setParameters
 public void setParameters(ParameterList params)
Sets parameter list of this method.

Parameters:
params - parameter list to set
 o getThrows
 public ClassTypeList getThrows()
Gets throw type name list of this method. Even if there is no throws, this returns an empty list.

Returns:
class type list
 o setThrows
 public void setThrows(ClassTypeList thrwlist)
Sets throw type name list of this method.

Parameters:
class - type list to set
 o getBody
 public StatementList getBody()
Gets body of this method. If the body is only semi colon such as the methods' body of interface, this returns null.

Returns:
statement list
 o setBody
 public void setBody(StatementList stmts)
Sets body of this method.

Parameters:
stmts - statement list to set
 o make
 public static MethodDeclaration make(String str)

All Packages  Class Hierarchy  This Package  Previous  Next  Index