public final class CtMethod extends CtBehavior
| Modifier and Type | Class and Description |
|---|---|
static class |
CtMethod.ConstParameter |
| Modifier and Type | Field and Description |
|---|---|
protected String |
cachedStringRep |
methodInfodeclaringClass| Constructor and Description |
|---|
CtMethod(CtClass returnType,
String mname,
CtClass[] parameters,
CtClass declaring)
Creates a public abstract method.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Indicates whether
obj has the same name and the
same signature as this method. |
String |
getLongName()
Returns the method name followed by parameter types
such as
javassist.CtMethod.setBody(String). |
String |
getName()
Obtains the name of this method.
|
CtClass |
getReturnType()
Obtains the type of the returned value.
|
int |
hashCode()
Returns a hash code value for the method.
|
boolean |
isEmpty()
Returns true if the method body is empty, that is,
{}. |
static CtMethod |
make(MethodInfo minfo,
CtClass declaring)
Creates a method from a
MethodInfo object. |
void |
setName(String newname)
Changes the name of this method.
|
addLocalVariable, addParameter, extendToString, getAnnotation, getAnnotations, getAttribute, getAvailableAnnotations, getAvailableParameterAnnotations, getExceptionTypes, getMethodInfo, getMethodInfo2, getModifiers, getParameterAnnotations, getParameterTypes, getSignature, hasAnnotation, insertParameter, setAttribute, setExceptionTypes, setModifiersgetDeclaringClass, toString, visibleFromprotected String cachedStringRep
public CtMethod(CtClass returnType, String mname, CtClass[] parameters, CtClass declaring)
CtClass.addMethod().declaring - the class to which the created method is added.returnType - the type of the returned valuemname - the method nameparameters - a list of the parameter typesCtClass.addMethod(CtMethod)public static CtMethod make(MethodInfo minfo, CtClass declaring) throws CannotCompileException
MethodInfo object.declaring - the class declaring the method.CannotCompileException - if the the MethodInfo
object and the declaring class have different
ConstPool objectspublic int hashCode()
public boolean equals(Object obj)
obj has the same name and the
same signature as this method.public String getLongName()
javassist.CtMethod.setBody(String).getLongName in class CtBehaviorpublic String getName()
getName in class CtMemberCtConstructor.getName()public void setName(String newname)
public CtClass getReturnType() throws NotFoundException
NotFoundExceptionpublic boolean isEmpty()
{}.
It also returns true if the method is an abstract method.isEmpty in class CtBehaviorCopyright © December 07, 2012–2015 The Internet Party. All rights reserved.