org.exolab.javasource
public final class JMethod extends Object implements JMember, JAnnotatedElement
Version: $Revision: 6324 $ $Date: 2004-12-03 11:57:33 -0700 (Fri, 03 Dec 2004) $
Constructor Summary | |
---|---|
JMethod(String name)
Creates a new JMethod with the given name and "void" return type.
| |
JMethod(String name, JType returnType, String returnDoc)
Creates a new JMethod with the given name and returnType. |
Method Summary | |
---|---|
void | addAnnotation(JAnnotation annotation) |
protected void | addDeclaringClass(JClass jClass)
Adds the given JClass to the set of classes that contain this method.
|
void | addException(JClass exp, String description)
Adds the given Exception to this JMethod's throws clause.
|
void | addParameter(JParameter parameter)
Adds the given parameter to this JMethod's list of parameters.
|
JAnnotation | getAnnotation(JAnnotationType annotationType) |
JAnnotation[] | getAnnotations() |
JClass[] | getExceptions()
Returns the exceptions that this JMethod throws.
|
JDocComment | getJDocComment()
Returns the JavaDoc comment describing this JMethod.
|
JModifiers | getModifiers()
Returns the modifiers for this JMethod.
|
String | getName()
Returns the name of this JMethod.
|
JParameter | getParameter(int index)
Returns the JParameter at the given index.
|
protected String[] | getParameterClassNames()
Return the list of class names representing the parameters.
|
JParameter[] | getParameters()
Returns the set of JParameters for this JMethod.
|
JType | getReturnType()
Returns the JType that represents the return type of the JMethod.
|
JMethodSignature | getSignature()
Returns the JMethodSignature for this JMethod.
|
JSourceCode | getSourceCode()
Returns the JSourceCode for the method body.
|
boolean | hasAnnotations() |
boolean | isAnnotationPresent(JAnnotationType annotationType) |
void | print(JSourceWriter jsw)
Prints this JMethod to the given JSourceWriter.
|
JAnnotation | removeAnnotation(JAnnotationType annotationType) |
protected void | removeDeclaringClass(JClass jClass)
Removes the given JClass from the set of classes that contain this method.
|
void | setComment(String comment)
Sets the comment describing this JMethod. |
void | setModifiers(JModifiers modifiers)
Sets the JModifiers for this JMethod. |
void | setName(String name)
Sets the name of this JMethod.
|
void | setSourceCode(String source)
Sets the given string as the source code (method body) for this JMethod.
|
void | setSourceCode(JSourceCode source)
Sets the given JSourceCode as the source code (method body) for this
JMethod.
|
String | toString()
Returns the String representation of this JMethod, which is the method
prototype.
|
Parameters: name the method name. Must not be null.
Parameters: name the method name. Must not be null. returnType the return type of the method. Must not be null. returnDoc javadoc comment for the @return annotation. If null, a default (and mostly useless) javadoc comment will be generated.
Parameters: jClass the JClass to add as one of the JClasses that contain this method
Parameters: exp the JClass representing the Exception description JavaDoc comment explaining when this exception is thrown
Parameters: parameter the parameter to add to the this JMethod's list of parameters.
See Also:
{@inheritDoc }
Returns: the exceptions that this JMethod throws.
Returns: the JavaDoc comment describing this JMethod.
Returns: the modifiers for this JMethod.
Returns: the name of this JMethod.
Parameters: index the index of the JParameter to return
Returns: the JParameter at the given index.
Returns: the list of class names representing the parameters
See Also: JMethodSignature
Note: the array is a copy, the parameters in the array are the actual references
Returns: the set of JParameters for this JMethod.
Returns: the JType that represents the return type of the JMethod.
Returns: the JMethodSignature for this JMethod.
Returns: the JSourceCode for the method body.
See Also:
{@inheritDoc }
Parameters: jsw the JSourceWriter to print to
Parameters: jClass the JClass to remove as one of the JClasses that contain this method
Parameters: comment the comment for this member
See Also: JMethod
Note: The JModifiers will be set in the containing JMethodSignature. If the JMethodSignature is used by other methods, keep in mind that it will be changed.
Parameters: modifiers the JModifiers to set.
Parameters: name the name of this method
Parameters: source the String that represents the method body
Parameters: source the JSourceCode that represents the method body
Returns: the String representation of this JMethod, which is simply the method prototype