|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.thoughtworks.proxy.toys.delegate.DelegatingInvoker
public class DelegatingInvoker
Invoker that delegates method calls to an object.
This forms the basis of many other proxy toys. The delegation behaviour was factored out of HotSwappingInvoker.
HotSwappingInvoker
,
Serialized FormConstructor Summary | |
---|---|
DelegatingInvoker(Object delegate)
Construct a DelegatingInvoker with a StandardProxyFactory and Delegating.MODE_SIGNATURE . |
|
DelegatingInvoker(ProxyFactory proxyFactory,
ObjectReference delegateReference,
boolean staticTyping)
Deprecated. since 0.2, use DelegatingInvoker(ProxyFactory, ObjectReference, int) |
|
DelegatingInvoker(ProxyFactory proxyFactory,
ObjectReference delegateReference,
int delegationMode)
Construct a DelegatingInvoker. |
Method Summary | |
---|---|
protected Object |
delegate()
Retrieve the delegated object in derived classes. |
boolean |
equals(Object obj)
Compares a DelegatingInvoker with another one for equality. |
protected ObjectReference |
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 delegateReference, int 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
Delegating
public DelegatingInvoker(ProxyFactory proxyFactory, ObjectReference delegateReference, boolean staticTyping)
DelegatingInvoker(ProxyFactory, ObjectReference, int)
proxyFactory
- the ProxyFactory
to usedelegateReference
- the ObjectReference
of the delegatestaticTyping
- Delegating.STATIC_TYPING
or Delegating.DYNAMIC_TYPING
public DelegatingInvoker(Object delegate)
StandardProxyFactory
and Delegating.MODE_SIGNATURE
.
delegate
- the delegated objectMethod Detail |
---|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
Invoker
invoke
in interface Invoker
proxy
- the proxy instance.method
- the method to invoke.args
- the arguments of the mothod.
Throwable
- if the invoked method has thrown.protected Object 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 foundprotected 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 getDelegateReference()
ObjectReference
of the delegate.
protected ProxyFactory getProxyFactory()
ProxyFactory
to use.
public boolean equals(Object obj)
equals
in class Object
Object.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 |