This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Best regards, Martin Egholm
import java.lang.reflect.*; public class ProxyTest2 { public static void main(String[] args) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { System.out.println("1: starting..."); ClassLoader classLoader = Runnable.class.getClassLoader(); System.out.println("2: classloader: " + classLoader); Class proxyClass = Proxy.getProxyClass(classLoader, new Class[] { Runnable.class }); System.out.println("3: proxyClass: " + proxyClass); Constructor constructor = proxyClass.getConstructor(new Class[] { InvocationHandler.class }); System.out.println("4: constructor: " + constructor); InvocationHandler myHandler = new InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { System.out.println("In invoke...: " + method.getName()); return null; } // invoke }; // myHandler Runnable r = (Runnable) constructor.newInstance(new Object[] { myHandler }); System.out.println("5: got proxy! About to invoke..."); r.toString(); } // main } // ProxyTest2
------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |