public static void watchForChanges(String path, Operation<String> changeListener) { Class<?> watch = Cls.getClassIfExists("org.rapidoid.io.watch.Watch"); if (watch != null) { Method dir = Cls.getMethod(watch, "dir", String.class, Operation.class); Cls.invokeStatic(dir, path, changeListener); } }
public static void invokeMain(Class<?> clazz, String[] args) { Method main = Cls.getMethod(clazz, "main", String[].class); U.must(main.getReturnType() == void.class); U.must(Modifier.isPublic(main.getModifiers())); U.must(Modifier.isStatic(main.getModifiers())); Cls.invokeStatic(main, new Object[]{args}); }
Method m = Cls.getMethod(clazz, "toString"); if (!m.getDeclaringClass().equals(Object.class)) { return bean.toString();
Method m = Cls.getMethod(clazz, "toString"); if (!m.getDeclaringClass().equals(Object.class)) { return bean.toString();
public static List<Method> getDeclaredMethods(Class<?> clazz) { ClassPool cp = new ClassPool(); cp.insertClassPath(new ClassClassPath(clazz)); CtClass cc; try { cc = cp.get(clazz.getName()); } catch (NotFoundException e) { throw U.rte("Cannot find the target class!", e); } List<Method> methods = U.list(); for (CtMethod m : cc.getDeclaredMethods()) { try { methods.add(getMethod(clazz, m.getName(), ctTypes(m.getParameterTypes()))); } catch (Exception e) { throw U.rte(e); } } return methods; }
public static void oauth(Setup setup) { Class<?> oauthClass = Cls.getClassIfExists("org.rapidoid.oauth.OAuth"); U.must(oauthClass != null, "Cannot find the OAuth components, is module 'rapidoid-oauth' missing?"); Method bootstrap = Cls.getMethod(oauthClass, "bootstrap", Setup.class); Cls.invokeStatic(bootstrap, setup); }
Method m = Cls.getMethod(clazz, "toString"); if (!m.getDeclaringClass().equals(Object.class)) { return bean.toString();
Method m = Cls.getMethod(clazz, "toString"); if (!m.getDeclaringClass().equals(Object.class)) { return bean.toString();