Create a object with a specific interface/class that delegates all method calls to the delegator objects passed in as parameters. Notice that you can get polymorphic behavior with this delegation method. @param target object type @param proxyInterface interface/class of th
(Class<T> proxyInterface, Object... delegates)
| 65 | * @return a proxy object that delegates method calls to it's delegates. |
| 66 | */ |
| 67 | public static <T> T delegate(Class<T> proxyInterface, Object... delegates) { |
| 68 | if (proxyInterface.isInterface()) { |
| 69 | return delegateInterface(proxyInterface, delegates); |
| 70 | } |
| 71 | return delegateClass(proxyInterface, delegates); |
| 72 | } |
| 73 | |
| 74 | private static <T> T delegateClass(Class<T> proxyInterface, Object... delegates) { |
| 75 | T proxy = InterceptableProxyFactory.createANewClassProxy(proxyInterface, |