CodeConverter conv = new CodeConverter(); conv.redirectMethodCall(modelGetClass, newGetClass);
for (CtMethod method : modelMethods) { int modifiers = method.getModifiers(); if (Modifier.isStatic(modifiers)) { if (targetHasMethod(targetMethods, method)) { Instrumentation.log("Detected method: " + method.getName() + ", skipping delegate."); } else { CtMethod newMethod; if (Modifier.isProtected(modifiers) || Modifier.isPublic(modifiers)) { newMethod = CtNewMethod.copy(method, target, classMap); newMethod.instrument(conv); } else if ("modelClass".equals(method.getName())) { newMethod = newGetClass; } else { newMethod = CtNewMethod.delegator(method, target); }
for (Object attr : method.getMethodInfo().getAttributes()) { if (attr instanceof SignatureAttribute) { newMethod.getMethodInfo().addAttribute((SignatureAttribute) attr); } } target.addMethod(newMethod); } } }
Hi there,I have been reading the ActiveJDBC source code.I would like to know what this piece of code does ?
CodeConverter conv = new CodeConverter(); conv.redirectMethodCall(modelGetClass, newGetClass); for (CtMethod method : modelMethods) { int modifiers = method.getModifiers(); if (Modifier.isStatic(modifiers)) { if (targetHasMethod(targetMethods, method)) { Instrumentation.log("Detected method: " + method.getName() + ", skipping delegate."); } else { CtMethod newMethod; if (Modifier.isProtected(modifiers) || Modifier.isPublic(modifiers)) { newMethod = CtNewMethod.copy(method, target, classMap); newMethod.instrument(conv); } else if ("modelClass".equals(method.getName())) { newMethod = newGetClass; } else { newMethod = CtNewMethod.delegator(method, target); } for (Object attr : method.getMethodInfo().getAttributes()) { if (attr instanceof SignatureAttribute) { newMethod.getMethodInfo().
...