Aspect Declarations
Prev Chapter 9. An Annotation Based Development Style Next

Aspect Declarations

Aspect declarations are supported by the org.aspectj.lang.annotation.Aspect annotation. The declaration:

 @Aspect
 public class Foo {}
 

Is equivalent to:

 public aspect Foo {}
 

To specify an aspect an aspect instantiation model (the default is singleton), provide the perclause as the @Aspect value. For example:

 @Aspect("perthis(execution(* abc..*(..)))")
 public class Foo {}
 

is equivalent to...

 public aspect Foo perthis(execution(* abc..*(..))) {}
 

Limitations

Privileged aspects are not supported by the annotation style.


Prev Home Next
Chapter 9. An Annotation Based Development Style Up Pointcuts and Advice

AltStyle によって変換されたページ (->オリジナル) /