本文整理汇总了Java中scouter.javassist.bytecode.ConstPool.addUtf8Info方法的典型用法代码示例。如果您正苦于以下问题:Java ConstPool.addUtf8Info方法的具体用法?Java ConstPool.addUtf8Info怎么用?Java ConstPool.addUtf8Info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scouter.javassist.bytecode.ConstPool
的用法示例。
在下文中一共展示了ConstPool.addUtf8Info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Annotation
import scouter.javassist.bytecode.ConstPool; //导入方法依赖的package包/类
/**
* Constructs an annotation that can be accessed through the interface
* represented by <code>clazz</code>. The values of the members are
* not specified.
*
* @param cp the constant pool table.
* @param clazz the interface.
* @throws NotFoundException when the clazz is not found
*/
public Annotation(ConstPool cp, CtClass clazz)
throws NotFoundException
{
// todo Enums are not supported right now.
this(cp.addUtf8Info(Descriptor.of(clazz.getName())), cp);
if (!clazz.isInterface())
throw new RuntimeException(
"Only interfaces are allowed for Annotation creation.");
CtMethod methods[] = clazz.getDeclaredMethods();
if (methods.length > 0) {
members = new LinkedHashMap();
}
for (int i = 0; i < methods.length; i++) {
CtClass returnType = methods[i].getReturnType();
addMemberValue(methods[i].getName(),
createMemberValue(cp, returnType));
}
}
示例2: computeMethodref
import scouter.javassist.bytecode.ConstPool; //导入方法依赖的package包/类
private int computeMethodref(int typedesc, ConstPool cp) {
int classIndex = cp.addClassInfo(trapClass);
int mnameIndex = cp.addUtf8Info(trapMethod);
typedesc = cp.addUtf8Info(
Descriptor.changeReturnType(classname,
cp.getUtf8Info(typedesc)));
return cp.addMethodrefInfo(classIndex,
cp.addNameAndTypeInfo(mnameIndex, typedesc));
}