../../AspectXLib/base/Base/aspects/AddClassField.axDC_DummyPunctualAction. This aspect program shows how aspect transformations
can be used to extend the internal state of a base class.
Pointcuts | |
| class | targetClass |
| Points to the target class where the new field should be added | |
Advices | |
| add | addVariableDeclaration |
| Add the declaration of the dummy variable in the target class | |
Triplet: class add declaration
dummyVariable. The dummy variable is declared to be private.
This is expressed through the use of the "accessModifier" element. This element must always be
present in code modifiers that add a declaration (either of a variable or of a method) to a
class. Note that the text that is added to the target class includes a line comment. This can
be done because XWeaver treats the text in the code modifier as a code fragment that is
inserted in the place identified by the pointcut but it does not attempt to parse or interpret
it. The text in the code modifier does not specify any indentation. The XWeaver will
automatically indent the text it inserts in the base code.Refers to global pointcut: class targetClass