|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.modello.plugin.java.javasource.JMethod
public class JMethod
A class which holds information about the methods of a JClass. Modelled closely after the Java Reflection API. This class is part of package which is used to create source code.
Constructor Summary | |
---|---|
JMethod(JType returnType,
java.lang.String name)
Creates a new JMethod with the given name and returnType. |
|
JMethod(java.lang.String name)
Creates a new JMethod with the given name and "void" return type. |
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. |
java.lang.String |
getName()
Returns the name of this JMember. |
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 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(java.lang.String comment)
Sets the comment describing this member. |
void |
setModifiers(JModifiers modifiers)
Sets the JModifiers for this JMethod. |
void |
setSourceCode(JSourceCode source)
Sets the given JSourceCode as the source code (method body) for this JMethod. |
void |
setSourceCode(java.lang.String source)
Sets the given string as the source code (method body) for this JMethod. |
java.lang.String |
toString()
Returns the String representation of this JMethod, which is the method prototype. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JMethod(java.lang.String name)
name,
- the method name. Must not be null.public JMethod(JType returnType, java.lang.String name)
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 parameterpublic JDocComment getJDocComment()
public JClass[] getExceptions()
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 JMethodSignature getSignature()
public JSourceCode getSourceCode()
public void setComment(java.lang.String comment)
comment
- the comment for this membergetJDocComment()
public void setModifiers(JModifiers modifiers)
modifiers
- the JModifiers to set.public void setSourceCode(java.lang.String source)
source
- the String that represents the method body.public void setSourceCode(JSourceCode source)
source
- the JSourceCode that represents the method body.public void print(JSourceWriter jsw)
jsw
- the JSourceWriter to print to.public java.lang.String toString()
toString
in class java.lang.Object
protected void addDeclaringClass(JClass jClass)
jClass
- the JClass to add as one of
the JClasses that contain this method.protected void removeDeclaringClass(JClass jClass)
jClass
- the JClass to add as one of
the JClasses that contain this method.protected java.lang.String[] getParameterClassNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |