public class DelegatingInvoker<T> extends Object implements Invoker
This forms the basis of many other proxy toys. The delegation behavior was factored out of HotSwappingInvoker.
HotSwappingInvoker,
Serialized Form| Constructor and Description |
|---|
DelegatingInvoker(ProxyFactory proxyFactory,
ObjectReference<T> delegateReference,
DelegationMode delegationMode)
Construct a DelegatingInvoker.
|
DelegatingInvoker(T delegate)
Construct a DelegatingInvoker with a
StandardProxyFactory and DelegationMode.SIGNATURE. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public DelegatingInvoker(ProxyFactory proxyFactory, ObjectReference<T> delegateReference, DelegationMode delegationMode)
proxyFactory - the ProxyFactory to usedelegateReference - the ObjectReference of the delegatedelegationMode - one of the delegation modesIllegalArgumentException - if the delegationMode is not one of the predefined constants of
Delegatingpublic DelegatingInvoker(T delegate)
StandardProxyFactory and DelegationMode.SIGNATURE.delegate - the delegated objectpublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable
Invokerprotected T delegate()
protected Method getMethodToInvoke(Method method, Object[] args)
method - the invoked method on the proxyargs - the arguments for the invocationDelegationException - if no matching method can be foundprotected Object invokeOnDelegate(Method method, Object[] args) throws InvocationTargetException
method - the method to invokeargs - the arguments for the invocationInvocationTargetException - 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)Copyright © 2005–2018 Codehaus. All rights reserved.