/** * Call execute() - any ant-like task should work */ public static void execute(Object proxy, String method) throws Exception { Method executeM = null; Class c = proxy.getClass(); Class params[] = new Class[0]; // params[0]=args.getClass(); executeM = findMethod(c, method, params); if (executeM == null) { throw new RuntimeException("No execute in " + proxy.getClass()); } executeM.invoke(proxy, (Object[]) null);//new Object[] { args }); }
/** * Call execute() - any ant-like task should work */ public static void execute(Object proxy, String method) throws Exception { Method executeM = null; Class<?> c = proxy.getClass(); Class<?> params[] = new Class[0]; // params[0]=args.getClass(); executeM = findMethod(c, method, params); if (executeM == null) { throw new RuntimeException("No execute in " + proxy.getClass()); } executeM.invoke(proxy, (Object[]) null);//new Object[] { args }); }
/** * Call execute() - any ant-like task should work */ public static void execute(Object proxy, String method) throws Exception { Method executeM = null; Class c = proxy.getClass(); Class params[] = new Class[0]; // params[0]=args.getClass(); executeM = findMethod(c, method, params); if (executeM == null) { throw new RuntimeException("No execute in " + proxy.getClass()); } executeM.invoke(proxy, (Object[]) null);//new Object[] { args }); }
/** * Call void getAttribute( String ) */ public static Object getAttribute(Object proxy, String n) throws Exception { Method executeM = null; Class<?> c = proxy.getClass(); Class<?> params[] = new Class[1]; params[0] = String.class; executeM = findMethod(c, "getAttribute", params); if (executeM == null) { if (logger.isLoggable(Level.FINE)) logger.fine("No getAttribute in " + proxy.getClass()); return null; } return executeM.invoke(proxy, new Object[] { n }); }
/** * Call void getAttribute( String ) */ public static Object getAttribute(Object proxy, String n) throws Exception { Method executeM = null; Class c = proxy.getClass(); Class params[] = new Class[1]; params[0] = String.class; executeM = findMethod(c, "getAttribute", params); if (executeM == null) { if (logger.isLoggable(Level.FINE)) logger.fine("No getAttribute in " + proxy.getClass()); return null; } return executeM.invoke(proxy, new Object[] { n }); }
/** * Call void getAttribute( String ) */ public static Object getAttribute(Object proxy, String n) throws Exception { Method executeM = null; Class c = proxy.getClass(); Class params[] = new Class[1]; params[0] = String.class; executeM = findMethod(c, "getAttribute", params); if (executeM == null) { if (logger.isLoggable(Level.FINE)) logger.fine("No getAttribute in " + proxy.getClass()); return null; } return executeM.invoke(proxy, new Object[] { n }); }
/** * Construct a URLClassLoader. Will compile and work in JDK1.1 too. */ public static ClassLoader getURLClassLoader(URL urls[], ClassLoader parent) { try { Class<?> urlCL = Class.forName("java.net.URLClassLoader"); Class<?> paramT[] = new Class[2]; paramT[0] = urls.getClass(); paramT[1] = ClassLoader.class; Method m = findMethod(urlCL, "newInstance", paramT); if (m == null) return null; ClassLoader cl = (ClassLoader) m.invoke(urlCL, new Object[] { urls, parent }); return cl; } catch (ClassNotFoundException ex) { // jdk1.1 return null; } catch (Exception ex) { ex.printStackTrace(); return null; } }
/** * Construct a URLClassLoader. Will compile and work in JDK1.1 too. */ public static ClassLoader getURLClassLoader(URL urls[], ClassLoader parent) { try { Class urlCL = Class.forName("java.net.URLClassLoader"); Class paramT[] = new Class[2]; paramT[0] = urls.getClass(); paramT[1] = ClassLoader.class; Method m = findMethod(urlCL, "newInstance", paramT); if (m == null) return null; ClassLoader cl = (ClassLoader) m.invoke(urlCL, new Object[] { urls, parent }); return cl; } catch (ClassNotFoundException ex) { // jdk1.1 return null; } catch (Exception ex) { ex.printStackTrace(); return null; } }
/** * Construct a URLClassLoader. Will compile and work in JDK1.1 too. */ public static ClassLoader getURLClassLoader(URL urls[], ClassLoader parent) { try { Class urlCL = Class.forName("java.net.URLClassLoader"); Class paramT[] = new Class[2]; paramT[0] = urls.getClass(); paramT[1] = ClassLoader.class; Method m = findMethod(urlCL, "newInstance", paramT); if (m == null) return null; ClassLoader cl = (ClassLoader) m.invoke(urlCL, new Object[] { urls, parent }); return cl; } catch (ClassNotFoundException ex) { // jdk1.1 return null; } catch (Exception ex) { ex.printStackTrace(); return null; } }
public static Object callMethod0(Object target, String methodN) throws Exception { if (target == null) { d("Assert: Illegal params " + target); return null; } if (dbg > 0) d("callMethod0 " + target.getClass().getName() + "." + methodN); Class params[] = new Class[0]; Method m = findMethod(target.getClass(), methodN, params); if (m == null) throw new NoSuchMethodException(target.getClass().getName() + " " + methodN); return m.invoke(target, emptyArray); }
public static Object callMethod0(Object target, String methodN) throws Exception { if (target == null) { d("Assert: Illegal params " + target); return null; } if (dbg > 0) d("callMethod0 " + target.getClass().getName() + "." + methodN); Class params[] = new Class[0]; Method m = findMethod(target.getClass(), methodN, params); if (m == null) throw new NoSuchMethodException(target.getClass().getName() + " " + methodN); return m.invoke(target, emptyArray); }
public static Object callMethod0(Object target, String methodN) throws Exception { if (target == null) { d("Assert: Illegal params " + target); return null; } if (dbg > 0) d("callMethod0 " + target.getClass().getName() + "." + methodN); Class params[] = new Class[0]; Method m = findMethod(target.getClass(), methodN, params); if (m == null) throw new NoSuchMethodException(target.getClass().getName() + " " + methodN); return m.invoke(target, emptyArray); }
public static Object callMethod1(Object target, String methodN, Object param1, String typeParam1, ClassLoader cl) throws Exception { if (target == null || param1 == null) { d("Assert: Illegal params " + target + " " + param1); } if (dbg > 0) d("callMethod1 " + target.getClass().getName() + " " + param1.getClass().getName() + " " + typeParam1); Class<?> params[] = new Class[1]; if (typeParam1 == null) params[0] = param1.getClass(); else params[0] = cl.loadClass(typeParam1); Method m = findMethod(target.getClass(), methodN, params); if (m == null) throw new NoSuchMethodException(target.getClass().getName() + " " + methodN); return m.invoke(target, new Object[] { param1 }); }
public static Object callMethodN(Object target, String methodN, Object params[], Class<?> typeParams[]) throws Exception { Method m = null; m = findMethod(target.getClass(), methodN, typeParams); if (m == null) { d("Can't find method " + methodN + " in " + target + " CLASS " + target.getClass()); return null; } Object o = m.invoke(target, params); if (dbg > 0) { // debug StringBuilder sb = new StringBuilder(); sb.append("" + target.getClass().getName() + "." + methodN + "( "); for (int i = 0; i < params.length; i++) { if (i > 0) sb.append(", "); sb.append(params[i]); } sb.append(")"); d(sb.toString()); } return o; }
public static Object callMethod1(Object target, String methodN, Object param1, String typeParam1, ClassLoader cl) throws Exception { if (target == null || param1 == null) { d("Assert: Illegal params " + target + " " + param1); } if (dbg > 0) d("callMethod1 " + target.getClass().getName() + " " + param1.getClass().getName() + " " + typeParam1); Class params[] = new Class[1]; if (typeParam1 == null) params[0] = param1.getClass(); else params[0] = cl.loadClass(typeParam1); Method m = findMethod(target.getClass(), methodN, params); if (m == null) throw new NoSuchMethodException(target.getClass().getName() + " " + methodN); return m.invoke(target, new Object[] { param1 }); }
public static Object callMethod1(Object target, String methodN, Object param1, String typeParam1, ClassLoader cl) throws Exception { if (target == null || param1 == null) { d("Assert: Illegal params " + target + " " + param1); } if (dbg > 0) d("callMethod1 " + target.getClass().getName() + " " + param1.getClass().getName() + " " + typeParam1); Class params[] = new Class[1]; if (typeParam1 == null) params[0] = param1.getClass(); else params[0] = cl.loadClass(typeParam1); Method m = findMethod(target.getClass(), methodN, params); if (m == null) throw new NoSuchMethodException(target.getClass().getName() + " " + methodN); return m.invoke(target, new Object[] { param1 }); }
public static Object callMethodN(Object target, String methodN, Object params[], Class typeParams[]) throws Exception { Method m = null; m = findMethod(target.getClass(), methodN, typeParams); if (m == null) { d("Can't find method " + methodN + " in " + target + " CLASS " + target.getClass()); return null; } Object o = m.invoke(target, params); if (dbg > 0) { // debug StringBuffer sb = new StringBuffer(); sb.append("" + target.getClass().getName() + "." + methodN + "( "); for (int i = 0; i < params.length; i++) { if (i > 0) sb.append(", "); sb.append(params[i]); } sb.append(")"); d(sb.toString()); } return o; }
public static boolean processArgs(Object proxy, String args[]) throws Exception { String args0[] = null; if (null != findMethod(proxy.getClass(), "getOptions1", new Class[] {})) { args0 = (String[]) callMethod0(proxy, "getOptions1"); } if (args0 == null) { //args0=findVoidSetters(proxy.getClass()); args0 = findBooleanSetters(proxy.getClass()); } Hashtable h = null; if (null != findMethod(proxy.getClass(), "getOptionAliases", new Class[] {})) { h = (Hashtable) callMethod0(proxy, "getOptionAliases"); } return processArgs(proxy, args, args0, null, h); }
public static boolean processArgs(Object proxy, String args[]) throws Exception { String args0[] = null; if (null != findMethod(proxy.getClass(), "getOptions1", new Class[] {})) { args0 = (String[]) callMethod0(proxy, "getOptions1"); } if (args0 == null) { //args0=findVoidSetters(proxy.getClass()); args0 = findBooleanSetters(proxy.getClass()); } Hashtable h = null; if (null != findMethod(proxy.getClass(), "getOptionAliases", new Class[] {})) { h = (Hashtable) callMethod0(proxy, "getOptionAliases"); } return processArgs(proxy, args, args0, null, h); }
public static boolean processArgs(Object proxy, String args[]) throws Exception { String args0[] = null; if (null != findMethod(proxy.getClass(), "getOptions1", new Class[] {})) { args0 = (String[]) callMethod0(proxy, "getOptions1"); } if (args0 == null) { //args0=findVoidSetters(proxy.getClass()); args0 = findBooleanSetters(proxy.getClass()); } Hashtable<String, String> h = null; if (null != findMethod(proxy.getClass(), "getOptionAliases", new Class[] {})) { h = (Hashtable<String, String>) callMethod0(proxy, "getOptionAliases"); } return processArgs(proxy, args, args0, null, h); }