|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.lang.reflect.FacadeInvoker
public class FacadeInvoker
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});
Constructor Summary | |
---|---|
protected |
FacadeInvoker(java.lang.Object target)
|
Method Summary | |
---|---|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
static java.lang.Object |
newInstance(java.lang.Object target,
java.lang.Class[] interfaces)
Creates an object that implements the giving interfaces by wrapping a giving object, traget. |
static java.lang.Object |
newInstance(java.lang.Object target,
java.lang.Class[] interfaces,
java.lang.ClassLoader clsLoader)
Creates an object that implements the giving interfaces by wrapping a giving object, traget. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected FacadeInvoker(java.lang.Object target)
Method Detail |
---|
public static final java.lang.Object newInstance(java.lang.Object target, java.lang.Class[] interfaces, java.lang.ClassLoader clsLoader)
The target must have all methods in all given interfaces, but might not implement all these interfaces.
public static final java.lang.Object newInstance(java.lang.Object target, java.lang.Class[] interfaces)
A shortcut: newInstance( target, interfaces, Thread.currentThread().getContextClassLoader()).
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |