KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > samples > calcul > UserDefinedWrapper


1 /*
2   Copyright (C) AOPSYS (http://www.aopsys.com)
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU General Public License for more details.
13
14   You should have received a copy of the GNU General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */

18
19 package org.objectweb.jac.samples.calcul;
20
21 import org.aopalliance.intercept.ConstructorInvocation;
22 import org.aopalliance.intercept.MethodInvocation;
23 import org.objectweb.jac.core.*;
24
25 public class UserDefinedWrapper extends Wrapper {
26
27    public UserDefinedWrapper(AspectComponent ac) {
28       super(ac);
29    }
30
31    /*
32      public Object confirm()
33         throws ActionCanceledException
34      {
35
36         if( ! (wrappee() instanceof Calcul) ) return proceed();
37
38         Display display = (Display)attr("Gui.display");
39         if (display==null) return proceed();
40       
41         if( method().equals("add") ) {
42   
43            if ( ! display.showConfirm( "Are you sure to add " + arg(0) +
44                                        " to " + wrappee() + " ?" ) ) {
45               throw new ActionCanceledException();
46            }
47         }
48         return proceed();
49      }
50    */

51
52    public Object JavaDoc myWrappingMethod(Interaction interaction) {
53       Object JavaDoc ret=null;
54       System.out.println("Before "+interaction.method+":"+interaction.args[0]);
55       ret=proceed(interaction);
56       System.out.println("After "+interaction.method);
57       return ret;
58    }
59
60 /* (non-Javadoc)
61  * @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
62  */

63 public Object JavaDoc invoke(MethodInvocation invocation) throws Throwable JavaDoc {
64     // TODO Auto-generated method stub
65
return null;
66 }
67
68 /* (non-Javadoc)
69  * @see org.aopalliance.intercept.ConstructorInterceptor#construct(org.aopalliance.intercept.ConstructorInvocation)
70  */

71 public Object JavaDoc construct(ConstructorInvocation invocation) throws Throwable JavaDoc {
72     // TODO Auto-generated method stub
73
return null;
74 }
75
76 }
77
78 class ActionCanceledException extends Exception JavaDoc {}
79
80
81
82
83
84
85
86
87
Popular Tags