User Tools

Site Tools


basics:ex1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
basics:ex1 [2007/02/23 16:33]
bdefrain
basics:ex1 [2021/02/05 13:49] (current)
Line 1: Line 1:
 +[[basics:intro|Intro]]
 +[[basics:ex1|Ex1]]
 +[[basics:ex2|Ex2]]
 +[[basics:ex3|Ex3]]
 +[[basics:ex4|Ex4]]
 +[[basics:ex5|Ex5]]
 +[[basics:ex6|Ex6]]
 +[[basics:ex7|Ex7]]
 ====== The Basics: Exercise 1 ====== ====== The Basics: Exercise 1 ======
  
-Create an aspect named ''Basics''.+Create an aspect named ''Basics'' with an auxiliary method ''output'':
  
-Insidewrite an advice that prints out a string just before the execution of the ''start()'' method. Use the following form for your advice:+<code aspectj> 
 +public aspect Basics { 
 + 
 +  public void output(String tagObject o) { 
 +    System.out.println(tag + ": " + o); 
 +  } 
 + 
 +
 +</code> 
 + 
 +Next, add an advice to this aspect to prints a string just before the execution of the ''start()'' method. Use the following form for your advice:
  
 <code aspectj> <code aspectj>
 before(): <pointcut> { before(): <pointcut> {
-  System.out.println("About to start");+  output("ex1","About to start");
 } }
 </code> </code>
basics/ex1.1172244791.txt.gz · Last modified: 2007/02/23 16:33 by bdefrain