org.exolab.javasource
Class JMethodSignature
java.lang.Object
org.exolab.javasource.JMethodSignature
public final class JMethodSignature
extends java.lang.Object
A class which holds information about the signtaure
of a JMethod.
The code in this package was modelled after the Java Reflection API
as much as possible to reduce the learning curve.
$Revision: 1.1.1.1 $ $Date: 2003/03/03 07:09:55 $JMethodSignature(String name, JType returnType) - Creates a new method with the given name and return type.
|
JMethodSignature
public JMethodSignature(String name,
JType returnType)
Creates a new method with the given name and return type.
For "void" return types, simply pass in null as the returnType
returnType
- the return type of the method. May be null.
addException
public void addException(JClass exp)
Adds the given Exception to this JMethodSignature's throws clause.
exp
- the JClass representing the Exception
addParameter
public void addParameter(JParameter parameter)
throws IllegalArgumentException
Adds the given parameter to this JMethodSignature's list of
parameters.
parameter
- the parameter to add to the this Methods
list of parameters.
getExceptions
public JClass[] getExceptions()
Returns the exceptions that this JMethodSignature lists
in it's throws clause.
- the exceptions that this JMethodSignature lists
in it's throws clause.
getJDocComment
public JDocComment getJDocComment()
Returns the JDocComment describing this JMethodSignature
- the JDocComment describing this JMethodSignature
getModifiers
public JModifiers getModifiers()
Returns the modifiers for this JMethodSignature.
- the modifiers for this JMethodSignature.
getName
public String getName()
Returns the name of the method.
getParameter
public JParameter getParameter(int index)
Returns the JParameter at the given index.
index
- the index of the JParameter to return.
- the JParameter at the given index.
getParameterClassNames
protected String[] getParameterClassNames()
getParameters
public JParameter[] getParameters()
Returns the set of JParameters for this JMethodSignature
Note: the array is a copy, the params in the array
are the actual references.
- the set of JParameters for this JMethod
getReturnType
public JType getReturnType()
Returns the JType that represents the return type for the
method signature.
- the JType that represents the return type for the
method signature.
print
public void print(JSourceWriter jsw)
Prints the method signature. A semi-colon (end-of-statement
terminator ';') will Not be printed.
jsw
- the JSourceWriter to print to.
print
public void print(JSourceWriter jsw,
boolean printJavaDoc)
Prints the method signature. A semi-colon (end-of-statement
terminator ';') will Not be printed.
jsw
- the JSourceWriter to print to.printJavaDoc
- a boolean that when true prints the JDocComment
associated with this method signature.
setComment
public void setComment(String comment)
Sets the comment describing this JMethodSignature.
comment
- the comment for this member
setModifiers
public void setModifiers(JModifiers modifiers)
Sets the JModifiers for this method signature.
modifiers
- the JModifiers for this method signature.
toString
public String toString()
Returns the String representation of this JMethod,
which is the method prototype.
- the String representation of this JMethod, which
is simply the method prototype
Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com