Appendix A. The AspectJ Runtime API

It is sometimes useful to access information about the join points that trigger an advice in your aspects at runtime, and AspectJ provides a runtime API in the org.aspectj.* packages that can be used for just this purpose. ??? shows the package breakdown for the AspectJ runtime API.

The package structure of the AspectJ runtime API
Figure A-1. The package structure of the AspectJ runtime API

The main packages of the AspectJ runtime API contain:

org.aspectj.lang

Provides interfaces and support classes for discovering runtime information about join points.

org.aspectj.lang.reflect

Contains interfaces that provide more specialized information concerning join point signatures.

org.aspectj.weaver.tools

Provides interfaces to support a JVM class loader in performing load-time weaving.

This appendix focuses on the contents of org.aspectj.lang and org.aspectj.lang.reflect and gives a brief overview of each of the main components in those packages. If you want to delve into the API, then the full documentation is available within your AspectJ installation at %ASPECTJ_INSTALLATION_DIR%/doc/api/index.html.

org.aspectj.lang

Similar to the familiar java.lang package that conatins the most fundamental constructs for the Java language, the org.aspectj.lang package provides a set of classes for interacting with join points at the most basic and common level.

JoinPoint and JoinPoint.StaticPart

Figure A-1Figure A-1

Get AspectJ Cookbook 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.