KickJava   Java API By Example, From Geeks To Geeks.

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


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.objectweb.jac.core.*;
22
23 public class UserDefinedAC extends AspectComponent {
24
25    protected UserDefinedWrapper wrapper = null;
26
27    public void whenUsingNewInstance(Interaction interaction) {
28
29       System.out.println( "When using new instance -- " +
30                           interaction.wrappee.getClass() );
31
32       /*wrappee().wrap( new Wrapper() {
33             public Object myWrappingMethod() {
34                System.out.println("--- BEFORE: "+this.method());
35                Object ret = proceed();
36                System.out.println("--- AFTER : "+this.method()+
37                                   " args were:"+java.util.Arrays.asList(this.args()));
38                return ret;
39             }
40          }, "myWrappingMethod", "add" );
41       */

42       /* if ( wrapper == null )
43          wrapper = new UserDefinedWrapper();
44
45       if(! ( wrappee() instanceof Calcul) ) return;
46
47       System.out.println ( "<<<< User-defined AC: " + wrappee() +
48                            " is extended now >>>>" );
49       //wrappee().wrapAll( wrapper, "confirm" );
50       wrappee().wrap( wrapper, "myWrappingMethod", "add" ); */

51     }
52
53    public void whenNewInstance( Wrappee newInstance ) {
54       System.out.println( "When new instance -- " + newInstance.getClass() );
55    }
56 }
57
58
59
60
61
62
63
64
Popular Tags