Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
compare webbrowser
Freenet DSL
Who's Online
7 user(s) are online (5 user(s) are browsing encyclopedia)

Members: 0
Guests: 7

more...
browser tip
Unix Befehle
manual of unix befehle
recommendation!
Sponsored
partner

AspectJ

AspectJ is an Aspect-oriented programming extension to the Java programming language created at Xerox PARC by Chris Maeda, who originally coined the term aspect-oriented programming (no one remembers exactly when). Gregor Kiczales coined the term crosscutting . The Xerox group s work was integrated into the Eclipse Foundation s Eclipse (computing) Java IDE in December 2002. This helped AspectJ become one of the most widely-used aspect-oriented programming languages.

In March 2005, AspectWerkz merged with AspectJ to form a single language. Other commercial Aspect-oriented frameworks include JBoss and Spring AOP.

= Simple Languge Description =

All valid Java programs are also valid AspectJ programs, but AspectJ also allows programmers to define special constructs called aspects . Aspects can contain several entities unavailable to standard classes. These are:

  • inter-type declarations — allow a programmer to add methods, fields, or interfaces to existing classes from within the aspect. This example adds an acceptVisitor method to the Point class:
  • ::aspect VisitAspect { :::Point.acceptVisitor(Visitor v) { ::::v.visit(this); :::} ::}

  • pointcuts — allow a programmer to specify a set of join points (well-defined moments in the execution of a program, like a method call, object instantiation, or variable accesses). All pointcuts are boolean expressions (quantifications) that evaluate to true whenever a matching joinpoint occurs. This pointcut captures all executions of any method that begins with set in an object of type Point:
  • ::pointcut set() : execution(* *.set*(..) ) && this(Point);

  • advice — allows a programmer to specify what actions to perform when a pointcut evaluates to true. The actions can be performed before , after , or around the specified join point. Here, the advice refreshes the display every time something on Point is set, using the pointcut declared above:
  • ::after () : set() { :::Display.update(); ::}

    See the [http://www.eclipse.org/aspectj/doc/released/progguide/index.html AspectJ Programming Guide] for a more detailed description of the language.

    = Tools, Compilation, and AspectJ =

    The compilation of an AspectJ program includes an additional stage compared to non-aspect-oriented languages. This stage is called weaving . Weaving occurs after the normal compilation of the non-aspect, or base code , completes. The weaving process takes the aspects (pointcuts and advice) and determines where the advice may apply and alters the bytecode appropriately. Weaving may occur immediately after compilation, or this process may be delayed until the classes are loaded into the JVM. This process is known as load-time weaving.

    The most widely used and most efficient compiler for AspectJ is maintained with the AspectJ project, but there is another, more extensible and research oriented, compiler called the Aspect Bench Compiler, or [http://aspectbench.org abc].

    A suite of tools designed specifically to work with AspectJ in the Eclipse (computing) Java IDE has been developed as another project in the Eclipse Foundation. It is called AJDT. These tools help programmers understand how the aspects crosscut the base code.

    = See Also =

  • Aspect-oriented programming
  • JBoss
  • AspectWerkz
  • Spring AOP
  • = External links =

  • http://eclipse.org/aspectj
  • http://aspectbench.org/
  • Xerox has for AOP/AspectJ, but published AspectJ source code under the [http://www.eclipse.org/legal/cpl-v10.html Common Public License], which grants some patent rights.
  • http://www.eclipse.org/aspectj/doc/released/progguide/index.html
  • [http://www.eclipse.org/ajdt/ AJDT]