KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dynaop > example > ProxyFactoryInterceptor


1 package dynaop.example;
2
3 import dynaop.Interceptor;
4 import dynaop.Invocation;
5 import dynaop.Proxy;
6 import dynaop.ProxyFactory;
7
8 /**
9  * Proxies results of invocations. Uses dynamic proxies to wrap results.
10  *
11  * @author Bob Lee (crazybob@crazybob.org)
12  */

13 public class ProxyFactoryInterceptor implements Interceptor {
14
15     public Object JavaDoc intercept(Invocation invocation) throws Throwable JavaDoc {
16         Object JavaDoc result = invocation.proceed();
17
18         // don't reproxy.
19
if (result instanceof Proxy)
20             return result;
21
22         return ProxyFactory.getInstance().wrap(result);
23     }
24
25 }
26
Popular Tags