use of org.hotswap.agent.javassist.bytecode.AnnotationDefaultAttribute in project HotswapAgent by HotswapProjects.
the class AnnotationImpl method getDefault.
private Object getDefault(String name, Method method) throws ClassNotFoundException, RuntimeException {
String classname = annotation.getTypeName();
if (pool != null) {
try {
CtClass cc = pool.get(classname);
ClassFile cf = cc.getClassFile2();
MethodInfo minfo = cf.getMethod(name);
if (minfo != null) {
AnnotationDefaultAttribute ainfo = (AnnotationDefaultAttribute) minfo.getAttribute(AnnotationDefaultAttribute.tag);
if (ainfo != null) {
MemberValue mv = ainfo.getDefaultValue();
return mv.getValue(classLoader, pool, method);
}
}
} catch (NotFoundException e) {
throw new RuntimeException("cannot find a class file: " + classname);
}
}
throw new RuntimeException("no default value: " + classname + "." + name + "()");
}
Aggregations