@Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) { return ASM.isAnnotationPresent(m, annotationType); }
protected static boolean isMonitored(MethodNode mn) { if(ASM.isAnnotationPresent(mn, Monitored.class)) { return true; } if(ASM.isConstructor(mn) || ASM.isStaticInit(mn)) { return false; } if(Modifier.isStatic(mn.access)) { return false; } String name = mn.name; if(name.startsWith("get") && name.length() > 3 && !ASM.hasArgument(mn)) { return false; } if(name.startsWith("is") && name.length() > 2 && !ASM.hasArgument(mn)) { return false; } if(name.startsWith("set") && name.length() > 3 && ASM.getArgumentSize(mn) == 1) { return false; } return true; }
@Override protected void processClass(AppInstrumentContext context, AppInstrumentClass ic, ClassInfo ci, boolean methodBodyOnly) { if(ASM.isAnnotationPresent(ci.cn, NonEntity.class)){ return; } boolean isModel = false; String superName = ci.cr.getSuperName(); if(MODEL_CLASS_NAME.equals(superName)){ isModel = true; }else if(!superName.equals("java/lang/Object")){ for(;;){ superName = readSuperName(ci.rs, superName); if(null == superName || superName.equals("java/lang/Object")){ break; } if(superName.equals(MODEL_CLASS_NAME)){ isModel = true; break; } } } if(isModel){ ClassWriter cw = new ClassWriter(ci.cr,ClassWriter.COMPUTE_FRAMES); instrument(context, ic, ci.cr, cw); } }
@Override protected void processClass(AppInstrumentContext context, AppInstrumentClass ic, ClassInfo ci, boolean methodBodyOnly) { ClassNode cn = ci.cn; if(null != cn.methods) { boolean hasTransactionalMethods = false; for(MethodNode mn : cn.methods) { if(ASM.isAnnotationPresent(mn, Transactional.class)) { hasTransactionalMethods = true; break; } } if(hasTransactionalMethods) { log.debug("Instrument Transactional class : {}", ic.getClassName()); Try.throwUnchecked(() -> { try(InputStream in = ci.is.getInputStream()) { context.updateInstrumented(ic, this, instrumentClass(ci.cn, new ClassReader(in), true), true); } }); } } }
ic.setBeanDeclared(ASM.isAnnotationPresent(cn, Bean.class));