KickJava   Java API By Example, From Geeks To Geeks.

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


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.Invocation;
13 import org.aopalliance.intercept.MethodInvocation;
14
15 import java.lang.reflect.AccessibleObject JavaDoc;
16 import java.lang.reflect.Method JavaDoc;
17
18 /**
19  * Adapts a <code>dynaop.Invocation</code> object to the
20  * <code>org.nanocontainer.nanoaop.MethodInvocation</code> interface.
21  *
22  * @author Stephen Molitor
23  * @version $Revision: 3144 $
24  */

25 class InvocationAdapter implements MethodInvocation {
26
27     private final Invocation delegate;
28
29     /**
30      * Creates a new <code>InvocationAdapter</code> that delegates to the
31      * given <code>dynaop.Invocation</code>.
32      *
33      * @param delegate the <code>dynaop.Invocation</code> object to delegate
34      * to.
35      */

36     InvocationAdapter(Invocation delegate) {
37         this.delegate = delegate;
38     }
39
40     public Method JavaDoc getMethod() {
41         return delegate.getMethod();
42     }
43
44     public Object JavaDoc[] getArguments() {
45         return delegate.getArguments();
46     }
47
48     public AccessibleObject JavaDoc getStaticPart() {
49         return delegate.getMethod();
50     }
51
52     public Object JavaDoc getThis() {
53         return delegate.getProxy().getProxyContext().unwrap();
54     }
55
56     public Object JavaDoc proceed() throws Throwable JavaDoc {
57         return delegate.proceed();
58     }
59
60 }
Popular Tags