Table of Contents
AspectJ extends Java by overlaying a concept of join points onto the existing Java semantics and adding a few new program elements to Java:
A join point is a well-defined point in the execution of a program. These include method and constructor calls, field accesses and others described below.
A pointcut picks out join points, and exposes some of the values in the
execution context of those join points. There are several primitive
pointcut designators, and others can be named and defined by the
pointcut
declaration.
A piece of advice is code that executes at each join point in a
pointcut. Advice has access to the values exposed by the
pointcut. Advice is defined by before
,
after
, and around
declarations.
Inter-type declarations form AspectJ's static crosscutting features,
that is, is code that may change the type structure of a program, by
adding to or extending interfaces and classes with new fields,
constructors, or methods. Some inter-type declarations are defined
through an extension of usual method, field, and constructor
declarations, and other declarations are made with a new
declare
keyword.
An aspect is a crosscutting type that encapsulates pointcuts, advice,
and static crosscutting features. By type, we mean Java's notion: a
modular unit of code, with a well-defined interface, about which it is
possible to do reasoning at compile time. Aspects are defined by the
aspect
declaration.