ca.ubc.cs.elide.nodes
Class MethodNode
java.lang.Object
|
+--ca.ubc.cs.elide.nodes.ParseNode
|
+--ca.ubc.cs.elide.nodes.ChildBearingNode
|
+--ca.ubc.cs.elide.nodes.ModifierBearingNode
|
+--ca.ubc.cs.elide.nodes.CodeBearingNode
|
+--ca.ubc.cs.elide.nodes.MethodNode
- All Implemented Interfaces:
- java.lang.Cloneable, java.io.Serializable
- Direct Known Subclasses:
- ConstructorNode
- public class MethodNode
- extends CodeBearingNode
A MethodNode
provides information about a single method on a class or interface.
The method may be a class method or an instance method.
The easiest way to create a new MethodNode
is with ClassNode.extend(java.lang.String)
or
NodeFactory.createMethod(java.lang.String)
.
- See Also:
- Serialized Form
Method Summary |
TypeNode[] |
getExceptionTypes()
Returns an array of TypeNode objects, representing the types of exception declared to be thrown from the method
represented by this object. |
ParameterNode |
getParameter(java.lang.String name)
Returns a ParameterNode object for a formal parameter of the method represented by this object, given its name. |
ParameterNode[] |
getParameters()
Returns an array of ParameterNode objects, representing the formal parameters of the method represented
by this MethodNode object. |
java.lang.String |
getReturnType()
Returns the the name of the formal return type of the method represented by this
MethodNode object. |
boolean |
isBodyless()
Returns true if the method represented by this MethodNode object is abstract ,
native , or is declared in an interface rather than a class . |
void |
setReturnType(java.lang.String returnType)
Sets the name of the formal return type of the method represented by this MethodNode object. |
Methods inherited from class ca.ubc.cs.elide.nodes.ModifierBearingNode |
getModifiers, makeDefaultAccess, makePrivate, makeProtected, makePublic, setAbstract, setFinal, setNative, setStatic, setSynchronized, setTransient, setVolatile |
Methods inherited from class ca.ubc.cs.elide.nodes.ParseNode |
findType, get, getComment, getDeclaringClass, getName, getPackage, getParent, getRoot, put, registerType, setComment, setName, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MethodNode
public MethodNode()
MethodNode
public MethodNode(java.lang.String name)
getReturnType
public java.lang.String getReturnType()
- Returns the the name of the formal return type of the method represented by this
MethodNode
object.
setReturnType
public void setReturnType(java.lang.String returnType)
- Sets the name of the formal return type of the method represented by this
MethodNode
object.
getParameters
public ParameterNode[] getParameters()
- Returns an array of
ParameterNode
objects, representing the formal parameters of the method represented
by this MethodNode
object.
getExceptionTypes
public TypeNode[] getExceptionTypes()
- Returns an array of
TypeNode
objects, representing the types of exception declared to be thrown from the method
represented by this object.
getParameter
public ParameterNode getParameter(java.lang.String name)
- Returns a
ParameterNode
object for a formal parameter of the method represented by this object, given its name. Returns null if no such
formal parameter exists.
isBodyless
public boolean isBodyless()
- Returns
true
if the method represented by this MethodNode
object is abstract
,
native
, or is declared in an interface rather than a class
. Returns false otherwise.