../../AspectXLib/base/Base/aspects/AddMethodComment.ax ../../AspectXLib/car/Car/aspects/CleanupComments.ax ../../AspectXLib/java/ShoppingCart/aspects/CleanupComments.axdoAction in class DC_DummyPunctualAction. Related
aspect programs (AddClassComment_1 and AddClassComment_2) show how the
class comments can be modified.
Adds a javadoc like comment to all undocumented method declarations. The generated comment has the following form:
/** * @author: XWeaver * * @param type * ... * @return type */
Printing the @param tags is done by iterating (xsl:for-each) the predefined $paramNames variable. Return comments are only printed if the return type is not 'void'
Adds a Javadoc comment to all undocumented methods. The generated comments have the following form:
/** * @author: XWeaver * * @param type * ... * @return type */
Printing the @param tags is done by iterating (xsl:for-each) the predefined $paramNames variable. Return comments are only printed if the return type is not 'void'
This aspect is an adapted aspect of the CleanupComments aspect used in the C++ Car example. The only thing which had to be changed was to replace the pointcut type src:function_decl to src:function because Java does not no such a thing as a function declaration.
Pointcuts | |
| class | targetClass |
| Points to the target class whose comment should be modified | |
| function_decl | targetMethodDeclaration |
| Points to the declaration of the target methods | |
| comment | targetMethodComment |
| Points to the comment that must be modified | |
| function_decl | UndocumentedMethods |
|
Points to all undocumented methods | |
| unit | UndocumentedFiles |
|
Points to all undocumented files | |
| function | UndocumentedMethods |
|
Points to all undocumented methods | |
| unit | UndocumentedFiles |
|
Points to all undocumented files | |
Advices | |
| end | addMethodComment |
| Add a comment at the end of the comment of the target class | |
| add | AddMethodComment |
| Adds a block comment | |
| add | AddFileComment |
| Adds a block comment | |
| add | AddMethodComment |
| Adds a block comment | |
| add | AddFileComment |
| Adds a block comment | |
targetMethodDeclaration pointcut. Triplet: comment end comment
AddClassComment_2
shows an alternative way to express the HTML tag.Refers to global pointcut: comment targetMethodComment
Triplet: function_decl add comment
Refers to global pointcut: function_decl UndocumentedMethods
Triplet: unit add comment
Refers to global pointcut: unit UndocumentedFiles
Triplet: function add comment
Refers to global pointcut: function UndocumentedMethods
Triplet: unit add comment
Refers to global pointcut: unit UndocumentedFiles