| java.lang.Object org.zkoss.lang.reflect.FacadeInvoker
FacadeInvoker | public class FacadeInvoker implements InvocationHandler(Code) | | The facade invocation handler. Like the facade pattern, this invocation
handler is used to facade an object with a set of interfaces.
This Invocation handler assumes the object being facaded
(aka, the target) has all methods of these interfaces, but it might not
implement all of these interfaces directly.
It happens when you need to provide interfaces to classes that
come from third parties.
Example:
class A {
public void f() {...}
}
interface I {
public void f();
}
Then, you could do:
I i = (I)FacadeInvoker.newInstance(new A(), new Class[] {I});
author: tomyeh |
newInstance | final public static Object newInstance(Object target, Class[] interfaces, ClassLoader clsLoader)(Code) | | Creates an object that implements the giving interfaces by
wrapping a giving object, traget.
The target must have all methods in all given interfaces,
but might not implement all these interfaces.
|
newInstance | final public static Object newInstance(Object target, Class[] interfaces)(Code) | | Creates an object that implements the giving interfaces by
wrapping a giving object, traget.
A shortcut: newInstance(
target, interfaces, Thread.currentThread().getContextClassLoader()).
|
|
|