KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > local > ExampleAspect


1 // $Id: ExampleAspect.java,v 1.1.1.1 2003/07/02 15:30:42 apopovic Exp $
2
// =====================================================================
3
//
4
// (history at end)
5
//
6

7 package local;
8
9
10 // used packages
11
import ch.ethz.prose.DefaultAspect;
12 import ch.ethz.prose.crosscut.Crosscut;
13 import ch.ethz.prose.crosscut.MethodCut;
14 import ch.ethz.prose.crosscut.REST;
15 import ch.ethz.prose.filter.PointCutter;
16 import ch.ethz.prose.filter.Executions;
17 import ch.ethz.prose.filter.Within;
18 import ch.ethz.prose.crosscut.MissingInformationException;
19
20 /**
21  * Class ExampleAspect
22  *
23  * @version $Revision: 1.1.1.1 $
24  * @author Andrei Popovici
25  */

26 public
27 class ExampleAspect extends DefaultAspect {
28
29     public Crosscut c1 = new MethodCut()
30     {
31         // trap Foo.*(..)
32
public void METHOD_ARGS(Foo x, String JavaDoc arg1,REST y)
33         {
34         System.err.println(" ->advice: before "+ x + ".'bar*'("+ arg1 +",..) called");
35         }
36
37       // .. && calls(* bar(..))
38
protected PointCutter pointCutter()
39         { return (Executions.before() . AND (Within.method("bar.*")) );}
40     };
41 }
42
43
44 //======================================================================
45
//
46
// $Log: ExampleAspect.java,v $
47
// Revision 1.1.1.1 2003/07/02 15:30:42 apopovic
48
// Imported from ETH Zurich
49
//
50
// Revision 1.4 2003/05/14 08:43:18 andfrei
51
// changed local example to package local
52
//
53
// Revision 1.3 2003/05/05 14:02:47 popovici
54
// renaming from runes to prose
55
//
56
// Revision 1.2 2003/04/27 13:08:56 popovici
57
// Specializers renamed to PointCutter
58
//
59
// Revision 1.1 2003/04/22 16:26:49 andfrei
60
// added a local test aspect
61
//
62
// Revision 1.5 2003/03/13 14:20:25 popovici
63
// Tools and modifications for a demo with remote clients
64
//
65
// Revision 1.4 2003/03/05 12:08:40 popovici
66
// Deobfuscation of exception filters. They are now
67
// top level classes. This is just an intermediate refactoring
68
// step. Many ExceptionS. predicate will be eliminated
69
// by more powerful Specializers like 'ExecutionS'
70
//
71
// Revision 1.3 2002/06/07 07:40:23 popovici
72
// Adapted to the ClasseS/DeclarationS, MethodCut, etc.. refactorization
73
//
74
// Revision 1.1 2002/03/27 13:56:39 popovici
75
// Legal and realease changes:
76
// added LEGAL & licenses
77
// added profiles/release
78
// added programs/* scripts for installation
79
// modified project/* files for installation
80
//
81
Popular Tags