use of act.asm.MethodVisitor in project actframework by actframework.
the class GenieFactoryFinder method byteCodeVisitor.
@Override
public ByteCodeVisitor byteCodeVisitor() {
return new ByteCodeVisitor() {
private boolean isPublic;
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
super.visit(version, access, name, signature, superName, interfaces);
isPublic = AsmTypes.isPublic(access);
isModule = Module.class.getName().equals(Type.getObjectType(superName).getClassName());
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
return !isPublic || isModule || isFactory ? mv : new MethodVisitor(ASM5, mv) {
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
Type annoType = Type.getType(desc);
if (AsmTypes.PROVIDES.asmType().equals(annoType)) {
isFactory = true;
}
return super.visitAnnotation(desc, visible);
}
};
}
};
}
use of act.asm.MethodVisitor in project actframework by actframework.
the class MailerEnhancer method visitMethod.
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
SenderMethodMetaInfo info = methodInfo(name, access);
if (null == info) {
return mv;
}
logger.debug(">>>About to enhance mailer method: %s", name);
return new SenderEnhancer(mv, info, access, name, desc, signature, exceptions);
}
Aggregations