public CtMethod[] getMethods() { try { return getSuperclass().getMethods(); } catch (NotFoundException e) { return super.getMethods(); } }
@Override public CtMethod[] getMethods() { try { return getSuperclass().getMethods(); } catch (NotFoundException e) { return super.getMethods(); } }
private void processMethods(CtClass clazz, boolean dontSearch) throws CannotCompileException, NotFoundException { CtMethod[] ms = clazz.getMethods(); for (int i = 0; i < ms.length; ++i) { CtMethod m = ms[i]; int mod = m.getModifiers(); if (Modifier.isPublic(mod) && !Modifier.isAbstract(mod)) processMethods0(mod, clazz, m, i, dontSearch); } }
private void processMethods(CtClass clazz, boolean dontSearch) throws CannotCompileException, NotFoundException { CtMethod[] ms = clazz.getMethods(); for (int i = 0; i < ms.length; ++i) { CtMethod m = ms[i]; int mod = m.getModifiers(); if (Modifier.isPublic(mod) && !Modifier.isAbstract(mod)) processMethods0(mod, clazz, m, i, dontSearch); } }
final CtMethod[] declaredMethods = ccInterface.getMethods(); invokerBody.append(" switch(methodId) { ");
CtMethod[] methods = orig.getMethods(); for (int i = 0; i < methods.length; i++) { CtMethod method = methods[i];
private static void modifyProxyFactory() throws NotFoundException, CannotCompileException, IOException { System.out.println("Generating method bodies for com.zaxxer.hikari.proxy.ProxyFactory"); String packageName = ProxyConnection.class.getPackage().getName(); CtClass proxyCt = classPool.getCtClass("com.zaxxer.hikari.pool.ProxyFactory"); for (CtMethod method : proxyCt.getMethods()) { switch (method.getName()) { case "getProxyConnection": method.setBody("{return new " + packageName + ".HikariProxyConnection($$);}"); break; case "getProxyStatement": method.setBody("{return new " + packageName + ".HikariProxyStatement($$);}"); break; case "getProxyPreparedStatement": method.setBody("{return new " + packageName + ".HikariProxyPreparedStatement($$);}"); break; case "getProxyCallableStatement": method.setBody("{return new " + packageName + ".HikariProxyCallableStatement($$);}"); break; case "getProxyResultSet": method.setBody("{return new " + packageName + ".HikariProxyResultSet($$);}"); break; default: // unhandled method break; } } proxyCt.writeFile(genDirectory + "target/classes"); }
for (final CtMethod m : ccInterface.getMethods())
for (CtMethod method : superCt.getMethods()) { if ((method.getModifiers() & Modifier.FINAL) == Modifier.FINAL) { superSigs.add(method.getName() + method.getSignature());
CtMethod[] methods = orig.getMethods(); for (int i = 0; i < methods.length; i++) { CtMethod method = methods[i];
public static void findMethods(String file) throws Exception { ClassPool cp = ClassPool.getDefault(); try (InputStream is = new FileInputStream(file)) { CtClass cc = cp.makeClass(is); for (CtMethod m : cc.getMethods()) { System.out.println(m); } } }
public static CtMethod[] getMethodsWithName(CtClass clazz, String name) { CtMethod[] methods = clazz.getMethods(); return getMethodsWithName(methods, name); }
private boolean hasGetClassMethod(CtClass _c) { final CtMethod[] methods = _c.getMethods(); for(CtMethod m: methods) { if(m.getLongName().equals("java.lang.Object.getClass()")) return true; } return false; } }
private boolean hasTestNGTests(CtClass classReference) { if (isTestNGTestClass(classReference)) { return true; } for (CtMethod ctMethod : classReference.getMethods()) { if (isTestNGTestMethod(ctMethod)) { return true; } } return false; }
public void implementMethodsFrom(final CtClass target, final CtClass source, final MethodGenerator function1) throws CannotCompileException { for (CtMethod method : source.getMethods()) { if (method.getDeclaringClass() == source) { CtMethod redeclaredMethod = new CtMethod(method, target, null); function1.process(redeclaredMethod); target.addMethod(redeclaredMethod); } } }
static Set<CtMethod> getAncestorMethods(CtMethod ctBehavior) { if (isPrivate(ctBehavior)) return new HashSet<CtMethod>(); Set<CtMethod> ancestorMethods = new HashSet<CtMethod>(); for (CtClass ancestorClassesOrInterface : getAssignableTypesExceptItself(ctBehavior)) { for (CtMethod candidate : ancestorClassesOrInterface.getMethods()) { if (isPrivate(candidate)) continue; if (!ctBehavior.getName().equals(candidate.getName())) continue; if (hasSameMethodParameterTypes(ctBehavior, candidate)) ancestorMethods.add(candidate); } } return ancestorMethods; }
private boolean hasJUnitTestMethods(CtClass classReference) { for (CtMethod ctMethod : classReference.getMethods()) { if (isJUnit5TestMethod(ctMethod) || isJUnit4TestMethod(ctMethod) || isJUnit3TestMethod(ctMethod)) { return true; } } return false; }
private void processMethods(CtClass clazz, boolean dontSearch) throws CannotCompileException, NotFoundException { CtMethod[] ms = clazz.getMethods(); for (int i = 0; i < ms.length; ++i) { CtMethod m = ms[i]; int mod = m.getModifiers(); if (Modifier.isPublic(mod) && !Modifier.isAbstract(mod)) processMethods0(mod, clazz, m, i, dontSearch); } }
private void processMethods(CtClass clazz, boolean dontSearch) throws CannotCompileException, NotFoundException { CtMethod[] ms = clazz.getMethods(); for (int i = 0; i < ms.length; ++i) { CtMethod m = ms[i]; int mod = m.getModifiers(); if (Modifier.isPublic(mod) && !Modifier.isAbstract(mod)) processMethods0(mod, clazz, m, i, dontSearch); } }
private void processMethods(CtClass clazz, boolean dontSearch) throws CannotCompileException, NotFoundException { CtMethod[] ms = clazz.getMethods(); for (int i = 0; i < ms.length; ++i) { CtMethod m = ms[i]; int mod = m.getModifiers(); if (Modifier.isPublic(mod) && !Modifier.isAbstract(mod)) processMethods0(mod, clazz, m, i, dontSearch); } }