Creating a top-level aspect
You can create aspects that are not enclosed in other types.
-
Open the New Aspect wizard.
-
Edit the Source Folder field as needed to indicate in which folder you want the new aspect to reside. You can either type a path or
click the Browse button to find the folder. If a folder is found for the current selection, that folder appears in
the Source Folder field as the container for the new aspect.
-
In the Package field, type or click Browse to select the package where you want the new aspect
to reside. Leave this field empty to indicate that you want the new aspect to be created in the default package.
-
Leave the Enclosing type box deselected.
-
In the Name field, type a name for the new aspect.
-
Select the public or default access modifier using the Modifiers radio buttons.
Note: The private and protected options are available only when creating a aspect enclosed in a type.
-
Optionally, select one of the instantiation options issingleton, perthis,
pertarget, percflow, percflowbelow or pertypewithin.
-
Optionally, select the abstract or final modifier for the new aspect using the appropriate check boxes:
Note: The static option is available only when creating a aspect enclosed in a type.
-
In the Supertype field, type or click Browse to select a superclass/aspect for the new aspect.
-
Click the Add button to add interfaces for the new aspect to implement.
-
If you want to create a main method stub in the new aspect:
-
Select the public static void main(String[] args) box if you want the wizard to add the main method to the new aspect, thus
making it a starting point of an application.
-
Optionally, select the Inherited abstract pointcuts box if you have overridden an abstract aspect
and want the wizard to generate stubs for the abstract pointcuts.
-
Optionally, select the Generate comments box if you want the wizard to generate comments, as configured in the properties
for the project.
-
Click Finish when you are done.
AspectJ projects
Aspects
Creating a new aspect
Creating a nested aspect