|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.javasource.JAnnotatedElementHelper
org.exolab.javasource.JMethodSignature
public final class JMethodSignature
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.
Constructor Summary | |
---|---|
JMethodSignature(java.lang.String name,
JType returnType)
Creates a new method with the given name and return type. |
Method Summary | |
---|---|
void |
addException(JClass exp)
Adds the given Exception to this JMethodSignature's throws clause. |
void |
addParameter(JParameter parameter)
Adds the given parameter to this JMethodSignature's list of parameters. |
JClass[] |
getExceptions()
Returns the exceptions that this JMethodSignature lists in it's throws clause. |
JDocComment |
getJDocComment()
Returns the JDocComment describing this JMethodSignature |
JModifiers |
getModifiers()
Returns the modifiers for this JMethodSignature. |
java.lang.String |
getName()
Returns the name of the method. |
JParameter |
getParameter(int index)
Returns the JParameter at the given index. |
protected java.lang.String[] |
getParameterClassNames()
|
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. |
JType |
getReturnType()
Returns the JType that represents the return type for the method signature. |
void |
print(JSourceWriter jsw)
Prints the method signature. |
void |
print(JSourceWriter jsw,
boolean printJavaDoc)
Prints the method signature. |
void |
setComment(java.lang.String comment)
Sets the comment describing this JMethodSignature. |
void |
setModifiers(JModifiers modifiers)
Sets the JModifiers for this method signature. |
void |
setName(java.lang.String name)
Sets the name of the method. |
java.lang.String |
toString()
Returns the String representation of this JMethod, which is the method prototype. |
Methods inherited from class org.exolab.javasource.JAnnotatedElementHelper |
---|
addAnnotation, getAnnotation, getAnnotations, hasAnnotations, isAnnotationPresent, main, printAnnotations, removeAnnotation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JMethodSignature(java.lang.String name, JType returnType)
name,
- the method name. Must not be null.returnType
- the return type of the method. May be null.Method Detail |
---|
public void addException(JClass exp)
exp
- the JClass representing the Exceptionpublic void addParameter(JParameter parameter) throws java.lang.IllegalArgumentException
parameter
- the parameter to add to the this Methods
list of parameters.
java.lang.IllegalArgumentException
- when a parameter already
exists for this Method with the same name as the new
parameter.public JClass[] getExceptions()
public JDocComment getJDocComment()
public JModifiers getModifiers()
public java.lang.String getName()
public JParameter getParameter(int index)
index
- the index of the JParameter to return.
public JParameter[] getParameters()
public JType getReturnType()
public void setName(java.lang.String name)
name
- the name of the methodpublic void setComment(java.lang.String comment)
comment
- the comment for this membergetJDocComment()
public void setModifiers(JModifiers modifiers)
modifiers
- the JModifiers for this method signature.public void print(JSourceWriter jsw)
jsw
- the JSourceWriter to print to.public void print(JSourceWriter jsw, boolean printJavaDoc)
jsw
- the JSourceWriter to print to.printJavaDoc
- a boolean that when true prints the JDocComment
associated with this method signature.public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.String[] getParameterClassNames()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |