KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nanocontainer > aop > dynaop > MethodInterceptorAdapter


1 /*****************************************************************************
2  * Copyright (c) PicoContainer Organization. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  * *
8  * Idea by Rachel Davies, Original code by various *
9  *****************************************************************************/

10 package org.nanocontainer.aop.dynaop;
11
12 import dynaop.Interceptor;
13 import dynaop.Invocation;
14 import org.aopalliance.intercept.MethodInterceptor;
15
16 /**
17  * Adapts a <code>org.aopalliance.intercept.MethodInterceptor</code> to the
18  * <code>dynaop.Interceptor</code> interface.
19  *
20  * @author Stephen Molitor
21  * @version $Revision: 3144 $
22  */

23 class MethodInterceptorAdapter implements Interceptor {
24
25     private final MethodInterceptor delegate;
26
27     /**
28      * Creates a new <code>MethodInterceptorAdapter</code> that will delegate
29      * to the given <code>org.aopalliance.intercept.MethodInterceptor</code>.
30      *
31      * @param delegate the
32      * <code>org.aopalliance.intercept.MethodInterceptor</code> to
33      * delegate to.
34      */

35     MethodInterceptorAdapter(MethodInterceptor delegate) {
36         this.delegate = delegate;
37     }
38
39     public Object JavaDoc intercept(Invocation invocation) throws Throwable JavaDoc {
40         return delegate.invoke(new InvocationAdapter(invocation));
41     }
42
43 }
Popular Tags