AddAllGetterMethods Aspect
[Observability Group]

This aspect is defined in file: ../../AspectXLib/Observability/Base/aspects/AddAllGetterMethods.ax

Aspect Description

Sample aspect program to add getter methods for all member variables of a given class. The getter methods offers observability over an internal variable of a target class.

This aspect is implemented through two advices. The first advice modifies the comment of the target class to include a statement that the class has been modified by an aspect weaver. The second advice adds set of inline method definitions (inclusive of their comment).

The name of the target class is Derived. The variables over which observability is given by the aspect program are assumed to be defined in the target class itself (as opposed to one of its superclasses).
Author:
A. Pasetti, O. Rohlik

Pointcuts

classtargetClass
 Points to the target class to which the getter method should be added
commenttargetClassComment
 Points to the comment of the target class where the getter method should be added

Advices

endaddClassComment
 Add a comment at the end of the comment of the target class
addaddMethodDeclaration
 Add the inline getter methods

Pointcut Documentation

class targetClass (source)
Points to the target class to which the getter method should be added.
comment targetClassComment (source)
Points to the comment of the target class where the getter method should be added. that must be modified. The comment that must be modified is the comment that is followed by the targetClass pointcut.

Advice Documentation

end addClassComment (source)

Triplet: comment end comment

Add a comment at the end of the comment of the target class. The comment thus inserted states that the class was modified by an aspect program and describes the nature of the modification.

Refers to global pointcut: comment targetClassComment

add addMethodDeclaration (source)

Triplet: class add declaration

Add the inline getter methods. Note that the code modifier must include a public accessModifier subelement to specify the access protection level of new methods.

The member variable names are obtained using two constructs of XSL language: xsl:for-each and xsl:value-of. Member variables are located by xsl:for-each instruction and transformed to string using xsl:value-of instruction.

Refers to global pointcut: class targetClass