Notes on using the Abstract Structure Model (ASM)
- The ASM contains the declaration hierarchy up to the member signature
level of granularity. In the case that an sub-method element is advised
(e.g. a call site, field get/set, or exception handler) the advised element
will also be present as a child of that member.
- The structure model is built during the compilation process, after advice planning is done and before bytecodes are produced. Here are the method calls involved with compiling and getting the model. The org.aspectj.asm package contains the structure model APIs.
Ajde.getDefault().getConfigurationManager().setActiveConfigFile("foo.lst");
Ajde.getDefault().getBuildManager().build(); Ajde.getDefault().getStructureModelManager().getStructureModel();
-
For examples of how to walk the model take a look at StructureModelTest in the test sources of the org.aspectj.ajde package.
-
If you're interested in being notified of when the model has been updated (i.e. when the user completed a compile) you can register a new listener with by calling the StructureModelManager.addListener method in the org.aspectj.asm package. The org.aspectj.ajde package also has an API for creating views of the model, and you can look to the any IDE plug-in to see how they are used.