This library provides the following enhancements to MagicDraw's APIs:
To enable these enhancements at runtime in MD, this library uses the so-called load-time weaving strategy. AspectJ is an aspect-oriented extension to Java. Because AspectJ operates at the level of bytecode, it is also applicable to other languages like Scala that compile to the JVM.
Whereas interface and class are the basic units of modularity in object-oriented programming,
AspectJ adds the concept of join point
-- a point in the flow of program execution -- and a few
related constructs as the basic unit of modularity in aspect-oriented programming:
- a
pointcut
selects one or morejoin points
to access runtime values at those points, - an
advice
is a piece of code that will be executed when thejoint points
of apointcut
will be reached and that will have access to thepointcut
's runtime values.
Executing AspectJ code requires weaving all the join points
, pointcuts
and advice
into the
existing code where each joint point
can possibly be triggered at runtime,
where each pointcut
may access runtime values at such join points
and where advice
code may need to be executed. Since this weaving process operates at the level of JVM bytecode,
the available strategies fall into two categories depending on when the JVM bytecode is modified:
-
Early:
compile-time weaving
andpost-compile weaving
occur during development, resulting in jar files with all the applicablejoin points
,pointcuts
andadvice
already woven.Pros: No runtime weaving overhead
Cons: Requires using the modified jar files with woven aspects instead of the original unmodified jar files
-
Late:
load-time weaving
examines each jar file loaded and weaves all applicablejoin points
,pointcuts
andadvice
before executionPros: No modification of existing jar files
Cons: Runtime weaving overhead (only when a library is loaded)
This package uses the Late load-time weaving
strategy and uses filters
to minimize the runtime overhead of the weaving process when loading libraries.