| java.lang.Object com.tc.common.proxy.DelegateHelper
DelegateHelper | public class DelegateHelper (Code) | | author: andrew A helper for easily creating overridden delegates for classes. |
createDelegate | public static Object createDelegate(Class[] theInterfaces, Object delegate)(Code) | | Creates a delegate object. The object returned will be an instance of the given interfaces. Any calls to the
returned object will simply call through to the passed-in delegate.
So why use this method? Well, delegate does not have to implement any of the given interface.
Any methods on the interface that are not implemented in the delegate will simply throw a
NoSuchMethodError if called. This is useful for many things — most especially, mock-object generation for tests.
|
createDelegate | public static Object createDelegate(Class[] theInterfaces, Object delegate, Object overrider)(Code) | | Creates a delegate object. The object returned will be an instance of the given interfaces; by default, it will
simply call through to the delegate object. However, any calls to methods of any of the interfaces that are also
defined in the overrider get sent there, instead.
Note that neither the delegate nor the overrider need comply to any of the given interfaces; if a method
in one of the interfaces is defined in neither the handler nor the delegate, you'll get a
NoSuchMethodError if you try to call it.
|
|
|