@Test public void testBuildCallPluginMethod() throws Exception { SimplePlugin plugin = new SimplePlugin(); registerPlugin(plugin); String s = PluginManagerInvoker.buildCallPluginMethod(plugin.getClass(), "callPluginMethod", "Boolean.TRUE", "java.lang.Boolean"); ClassPool classPool = ClassPool.getDefault(); classPool.appendSystemPath(); CtClass clazz = classPool.makeClass("Test"); clazz.addMethod(CtNewMethod.make("public void test() {" + s + "}", clazz)); Class<?> testClass = clazz.toClass(); Method testMethod = testClass.getDeclaredMethod("test"); testMethod.invoke(testClass.newInstance()); }
public static String buildCallPluginMethod(Class pluginClass, String method, String... paramValueAndType) { return buildCallPluginMethod("getClass().getClassLoader()", pluginClass, method, paramValueAndType); }
PluginManagerInvoker { public static String buildCallPluginMethod(Class pluginClass, String method, String... paramValueAndType) { return buildCallPluginMethod("getClass().getClassLoader()", pluginClass, method, paramValueAndType); } }
PluginManagerInvoker { public static String buildCallPluginMethod(Class pluginClass, String method, String... paramValueAndType) { return buildCallPluginMethod("getClass().getClassLoader()", pluginClass, method, paramValueAndType); }  }
PluginManagerInvoker { public static String buildCallPluginMethod(Class pluginClass, String method, String... paramValueAndType) { return buildCallPluginMethod("getClass().getClassLoader()", pluginClass, method, paramValueAndType); }  static T callInitializePlugin(Class<T> pluginClass, ClassLoader appClassLoader); static String buildInitializePlugin(Class pluginClass); static String buildInitializePlugin(Class pluginClass, String classLoaderVar); static void callCloseClassLoader(ClassLoader appClassLoader); static String buildCallCloseClassLoader(String classLoaderVar); static Object callPluginMethod(Class pluginClass, ClassLoader appClassLoader, String method, Class[] paramTypes, Object[] params); static String buildCallPluginMethod(Class pluginClass, String method, String... paramValueAndType); static String buildCallPluginMethod(String appClassLoaderVar, Class pluginClass,
                                               String method, String... paramValueAndType); }
PluginManagerInvoker { public static String buildCallPluginMethod(Class pluginClass, String method, String... paramValueAndType) { return buildCallPluginMethod("getClass().getClassLoader()", pluginClass, method, paramValueAndType); }  static T callInitializePlugin(Class<T> pluginClass, ClassLoader appClassLoader); static String buildInitializePlugin(Class pluginClass); static String buildInitializePlugin(Class pluginClass, String classLoaderVar); static void callCloseClassLoader(ClassLoader appClassLoader); static String buildCallCloseClassLoader(String classLoaderVar); static Object callPluginMethod(Class pluginClass, ClassLoader appClassLoader, String method, Class[] paramTypes, Object[] params); static String buildCallPluginMethod(Class pluginClass, String method, String... paramValueAndType); static String buildCallPluginMethod(String appClassLoaderVar, Class pluginClass,
                                               String method, String... paramValueAndType);  }