Chapter 9. Aspects

You have seen lots of examples of aspects so far in this book, and so you already know quite a lot about them. This chapter fills in the missing pieces that we haven’t touched on so far: aspect instantiation and lifecycle, abstract aspects and aspect inheritance, inner aspects, and privileged aspects. Before we get into that, the next section presents a short overview of the basic form of an aspect declaration.

Aspect Definition and Initialization

An aspect declaration looks very much like a class declaration, with the keyword class replaced by the keyword aspect. A bare-bones aspect declaration looks like this:

aspect AnAspect {
}

AJDT uses the icon to represent an aspect. Aspects may be declared either with default visibility ...

Get Eclipse AspectJ: Aspect-Oriented Programming with AspectJ and the Eclipse AspectJ Development Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.