org.codehaus.modello.plugin.java.javasource
public class JMethod extends Object implements JMember
Version: $Revision: 555 $ $Date: 2006-01-29 16:38:08 -0500 (Sun, 29 Jan 2006) $
Constructor Summary | |
---|---|
JMethod(String name)
Creates a new JMethod with the given name and "void" return type.
| |
JMethod(JType returnType, String name)
Creates a new JMethod with the given name and returnType.
|
Method Summary | |
---|---|
protected void | addDeclaringClass(JClass jClass)
Adds the given JClass to the set of classes that
contain this method.
|
void | addException(JClass exp)
Adds the given Exception to this Method's throws clause.
|
void | addParameter(JParameter parameter)
Adds the given parameter to this JMethod's list of parameters.
|
JClass[] | getExceptions()
Returns the exceptions that this JMember throws.
|
JDocComment | getJDocComment()
Returns the JDocComment describing this member. |
JModifiers | getModifiers()
Returns the modifiers for this JMember.
|
String | getName()
Returns the name of this JMember.
|
JParameter | getParameter(int index)
Returns the JParameter at the given index.
|
protected String[] | getParameterClassNames() |
JParameter[] | getParameters()
Returns the set of JParameters for this JMethod.
|
JType | getReturnType()
Returns the JType that represents the return type of the method.
|
JMethodSignature | getSignature()
Returns the JMethodSignature for this JMethod.
|
JSourceCode | getSourceCode()
Returns the JSourceCode for the method body.
|
void | print(JSourceWriter jsw)
Prints this JMethod to the given JSourceWriter.
|
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 member. |
void | setModifiers(JModifiers modifiers)
Sets the JModifiers for 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. May be null.
Parameters: jClass the JClass to add as one of the JClasses that contain this method.
Parameters: exp the JClass representing the Exception
Parameters: parameter the parameter to add to the this Methods list of parameters.
Throws: java.lang.IllegalArgumentException when a parameter already exists for this Method with the same name as the new parameter
Returns: the exceptions that this JMember throws.
Returns: the JDocComment describing this member.
Returns: the modifiers for this JMember.
Returns: the name of this JMember.
Parameters: index the index of the JParameter to return.
Returns: the JParameter at the given index.
Returns: the set of JParameters for this JMethod
Returns: the JType that represents the return type of the method.
Returns: the JMethodSignature for this JMethod.
Returns: the JSourceCode for the method body.
Parameters: jsw the JSourceWriter to print to.
Parameters: jClass the JClass to add as one of the JClasses that contain this method.
Parameters: comment the comment for this member
See Also: JMethod
Parameters: modifiers the JModifiers to set.
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