Java Code Examples for javassist.bytecode.ClassFile#getMethods()
The following examples show how to use
javassist.bytecode.ClassFile#getMethods() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FieldTransformer.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
private void transformInvokevirtualsIntoPutAndGetfields(ClassFile classfile) throws CannotCompileException { List methods = classfile.getMethods(); for (Iterator method_iter = methods.iterator(); method_iter.hasNext();) { MethodInfo minfo = (MethodInfo) method_iter.next(); String methodName = minfo.getName(); if (methodName.startsWith(EACH_READ_METHOD_PREFIX) || methodName.startsWith(EACH_WRITE_METHOD_PREFIX) || methodName.equals(GETFIELDHANDLER_METHOD_NAME) || methodName.equals(SETFIELDHANDLER_METHOD_NAME)) { continue; } CodeAttribute codeAttr = minfo.getCodeAttribute(); if (codeAttr == null) { return; } CodeIterator iter = codeAttr.iterator(); while (iter.hasNext()) { try { int pos = iter.next(); pos = transformInvokevirtualsIntoGetfields(classfile, iter, pos); pos = transformInvokevirtualsIntoPutfields(classfile, iter, pos); } catch (BadBytecode e) { throw new CannotCompileException(e); } } } }
Example 2
Source File: CheckForAnnotation.java From anno4j with Apache License 2.0 | 5 votes |
protected boolean isAnnotationPresent(ClassFile cf) { List<MethodInfo> methods = cf.getMethods(); for (MethodInfo info : methods) { AnnotationsAttribute attr = (AnnotationsAttribute) info .getAttribute(AnnotationsAttribute.visibleTag); if (isAnnotationPresent(attr)) return true; } return false; }
Example 3
Source File: AbstractRapidoidMojo.java From rapidoid with Apache License 2.0 | 5 votes |
private static boolean hasMainMethod(ClassFile cls) { int flags = cls.getAccessFlags(); if (Modifier.isInterface(flags) || Modifier.isAnnotation(flags) || Modifier.isEnum(flags)) return false; for (Object m : cls.getMethods()) { if (m instanceof MethodInfo) { if (isMainMethod((MethodInfo) m)) return true; } } return false; }
Example 4
Source File: JavassistAdapter.java From panda with Apache License 2.0 | 4 votes |
@Override public List<MethodInfo> getMethods(ClassFile cls) { return cls.getMethods(); }