Dynamic Proxy
From ADempiere
This Wiki is read-only for reference purposes to avoid broken links.
Example of Dynamic Proxy
public TestInterface { public void print(String value); } public TestProxy extends InvocationHandler { public Object invoke (Object proxy, Method method, Object[] args) { if (method.getName().equals("print")) { System.out.println(args[0]); return null; } return null; } } TestInterface instance = Proxy.newProxyInstance( TestInterface.class.getClassLoader(), new Class[] {TestInterface.class}, new TestProxy()); Instance.print("Hello World!"); // prints "Hello World!" //to stdout