|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.thoughtworks.proxy.toys.delegate.DelegatingInvoker<T>
public class DelegatingInvoker<T>
Invoker that delegates method calls to an object.
This forms the basis of many other proxy toys. The delegation behavior was factored out of HotSwappingInvoker.
HotSwappingInvoker,
Serialized Form| Constructor Summary | |
|---|---|
DelegatingInvoker(ProxyFactory proxyFactory,
ObjectReference<T> delegateReference,
DelegationMode delegationMode)
Construct a DelegatingInvoker. |
|
DelegatingInvoker(T delegate)
Construct a DelegatingInvoker with a StandardProxyFactory and DelegationMode.SIGNATURE. |
|
| Method Summary | |
|---|---|
protected T |
delegate()
Retrieve the delegated object in derived classes. |
boolean |
equals(Object obj)
Compares a DelegatingInvoker with another one for equality. |
protected ObjectReference<T> |
getDelegateReference()
Retrieve the ObjectReference of the delegate. |
protected Method |
getMethodToInvoke(Method method,
Object[] args)
Lookup a matching method. |
protected ProxyFactory |
getProxyFactory()
Retrieve the ProxyFactory to use. |
int |
hashCode()
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
Invocation of a method of the proxied object. |
protected Object |
invokeOnDelegate(Method method,
Object[] args)
Invoke the given method on the delegate. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DelegatingInvoker(ProxyFactory proxyFactory,
ObjectReference<T> delegateReference,
DelegationMode delegationMode)
proxyFactory - the ProxyFactory to usedelegateReference - the ObjectReference of the delegatedelegationMode - one of the delegation modes
IllegalArgumentException - if the delegationMode is not one of the predefined constants of
Delegatingpublic DelegatingInvoker(T delegate)
StandardProxyFactory and DelegationMode.SIGNATURE.
delegate - the delegated object| Method Detail |
|---|
public Object invoke(Object proxy,
Method method,
Object[] args)
throws Throwable
Invoker
invoke in interface Invokerproxy - the proxy instance.method - the method to invoke.args - the arguments of the method.
Throwable - if the invoked method has thrown.protected T delegate()
protected Method getMethodToInvoke(Method method,
Object[] args)
method - the invoked method on the proxyargs - the arguments for the invocation
DelegationException - if no matching method can be found
protected Object invokeOnDelegate(Method method,
Object[] args)
throws InvocationTargetException
method - the method to invokeargs - the arguments for the invocation
InvocationTargetException - if the invoked method throws any exceptionprotected ObjectReference<T> getDelegateReference()
ObjectReference of the delegate.
protected ProxyFactory getProxyFactory()
ProxyFactory to use.
public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||