Creating a top-level aspect

You can create aspects that are not enclosed in other types.

  1. Open the New Aspect wizard.
  2. 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.
  3. 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.
  4. Leave the Enclosing type box deselected.
  5. In the Name field, type a name for the new aspect.
  6. 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.
  7. Optionally, select one of the instantiation options issingleton, perthis, pertarget, percflow, percflowbelow or pertypewithin.
  8. 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.
  9. In the Supertype field, type or click Browse to select a superclass/aspect for the new aspect.
  10. Click the Add button to add interfaces for the new aspect to implement.
  11. If you want to create a main method stub in the new aspect:
  12. 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.
  13. Optionally, select the Generate comments box if you want the wizard to generate comments, as configured in the properties for the project.
  14. Click Finish when you are done.

Related concepts

AspectJ projects
Aspects

Related tasks

Creating a new aspect
Creating a nested aspect