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
-
MethodDeclaration(ModifierList, TypeSpecifier, Identifier, ParameterList, ClassTypeList, StatementList)
- Constructs new MethodDeclaration from its elements.
-
getBody()
- Gets body of this method.
-
getModifiers()
- Gets modifierlist of this method.
-
getName()
- Gets name of this method.
-
getParameters()
- Gets parameter list of this method.
-
getThrows()
- Gets throw type name list of this method.
-
getTypeSpecifier()
- Gets type specifier of this method.
-
make(String)
-
-
setBody(StatementList)
- Sets body of this method.
-
setModifiers(ModifierList)
- Sets modifierlist of this method.
-
setName(Identifier)
- Sets name of this method.
-
setParameters(ParameterList)
- Sets parameter list of this method.
-
setThrows(ClassTypeList)
- Sets throw type name list of this method.
-
setTypeSpecifier(TypeSpecifier)
- Sets type specifier of this method.
-
writeCode()
- Writes the code this parse-tree presents for.
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
writeCode
public void writeCode()
- Writes the code this parse-tree presents for.
- Overrides:
- writeCode in class NonLeaf
getModifiers
public ModifierList getModifiers()
- Gets modifierlist of this method.
- Returns:
- modifier list. Even if there is no modifiers, getModifiers
returns empty list
setModifiers
public void setModifiers(ModifierList modifs)
- Sets modifierlist of this method.
- Parameters:
- modifs - modifier list to set
getTypeSpecifier
public TypeSpecifier getTypeSpecifier()
- Gets type specifier of this method.
- Returns:
- type specifier node
setTypeSpecifier
public void setTypeSpecifier(TypeSpecifier tspec)
- Sets type specifier of this method.
- Parameters:
- tspec - type specifier to set
getName
public Identifier getName()
- Gets name of this method.
- Returns:
- method declarator node
setName
public void setName(Identifier name)
- Sets name of this method.
- Parameters:
- name - method's name
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
setParameters
public void setParameters(ParameterList params)
- Sets parameter list of this method.
- Parameters:
- params - parameter list to set
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
setThrows
public void setThrows(ClassTypeList thrwlist)
- Sets throw type name list of this method.
- Parameters:
- class - type list to set
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
setBody
public void setBody(StatementList stmts)
- Sets body of this method.
- Parameters:
- stmts - statement list to set
make
public static MethodDeclaration make(String str)
All Packages Class Hierarchy This Package Previous Next Index