User Tools

Site Tools


basics:intro

This is an old revision of the document!


The Basics: Intro

In this exercise, you will use aspects to instrument a dummy class in order to get acquianted with the basic techniques of AspectJ.

Set-up

  1. Create a new AspectJ Project in Eclipse
  2. Create the following Application class:
public class Application {
  public int go = 10;
 
  public void start() {
    System.out.println("Starting");
    stop(go);
  }
 
  public void stop(int i) {
    System.out.println("Stopping");
  }
 
  public void exec() throws Exception {
    throw new Exception("An exception");
  }
 
  public static void main(String[] args) {
    Application t = new Application();
    t.start();
    t.stop(25);
    try { t.exec(); }
    catch(Exception e) { System.out.println(e); }
  }
}
basics/intro.1172222526.txt.gz · Last modified: 2007/02/23 10:22 by bdefrain