本文整理匯總了Java中scouter.javassist.bytecode.MethodInfo.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java MethodInfo.getName方法的具體用法?Java MethodInfo.getName怎麽用?Java MethodInfo.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scouter.javassist.bytecode.MethodInfo
的用法示例。
在下文中一共展示了MethodInfo.getName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: delegator0
import scouter.javassist.bytecode.MethodInfo; //導入方法依賴的package包/類
private static CtMethod delegator0(CtMethod delegate, CtClass declaring)
throws CannotCompileException, NotFoundException
{
MethodInfo deleInfo = delegate.getMethodInfo2();
String methodName = deleInfo.getName();
String desc = deleInfo.getDescriptor();
ConstPool cp = declaring.getClassFile2().getConstPool();
MethodInfo minfo = new MethodInfo(cp, methodName, desc);
minfo.setAccessFlags(deleInfo.getAccessFlags());
ExceptionsAttribute eattr = deleInfo.getExceptionsAttribute();
if (eattr != null)
minfo.setExceptionsAttribute(
(ExceptionsAttribute)eattr.copy(cp, null));
Bytecode code = new Bytecode(cp, 0, 0);
boolean isStatic = Modifier.isStatic(delegate.getModifiers());
CtClass deleClass = delegate.getDeclaringClass();
CtClass[] params = delegate.getParameterTypes();
int s;
if (isStatic) {
s = code.addLoadParameters(params, 0);
code.addInvokestatic(deleClass, methodName, desc);
}
else {
code.addLoad(0, deleClass);
s = code.addLoadParameters(params, 1);
code.addInvokespecial(deleClass, methodName, desc);
}
code.addReturn(delegate.getReturnType());
code.setMaxLocals(++s);
code.setMaxStack(s < 2 ? 2 : s); // for a 2-word return value
minfo.setCodeAttribute(code.toCodeAttribute());
// a stack map is not needed.
return new CtMethod(minfo, declaring);
}