|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.javasource.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 method with the given name and returnType. |
Method Summary | |
void |
addException(JClass exp)
Adds the given Exception to this Method's throws clause |
void |
addParameter(JParameter parameter)
Adds the given parameter to this Methods list of parameters |
JClass |
getDeclaringClass()
Returns the class in which this JMember has been declared |
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()
|
JSourceCode |
getSourceCode()
|
void |
print(JSourceWriter jsw)
|
void |
setComment(java.lang.String comment)
Sets the comment describing this member. |
protected void |
setDeclaringClass(JClass declaringClass)
|
void |
setModifiers(JModifiers modifiers)
|
void |
setName(java.lang.String name)
Sets the name of this JMember |
void |
setSourceCode(JSourceCode source)
|
void |
setSourceCode(java.lang.String source)
|
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(JType returnType, java.lang.String name)
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 getDeclaringClass()
getDeclaringClass
in interface JMember
public JClass[] getExceptions()
public JModifiers getModifiers()
getModifiers
in interface JMember
public java.lang.String getName()
getName
in interface JMember
public JParameter getParameter(int index)
index
- the index of the JParameter to return
public JParameter[] getParameters()
public JType getReturnType()
public JSourceCode getSourceCode()
public void setComment(java.lang.String comment)
comment
- the comment for this membergetJDocComment()
public void setName(java.lang.String name) throws java.lang.IllegalArgumentException
name
- the name of this JMember
java.lang.IllegalArgumentException
- when the
name is not a valid Java member name, or if a member
with the given name already exists in the declaring classpublic void setModifiers(JModifiers modifiers)
protected void setDeclaringClass(JClass declaringClass)
public void setSourceCode(java.lang.String source)
public void setSourceCode(JSourceCode source)
public void print(JSourceWriter jsw)
public java.lang.String toString()
protected java.lang.String[] getParameterClassNames()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |