Adding annotations using the Annotations view
You can add annotations in your source code by using the Annotations view.
Before you begin
Procedure
- In the Enterprise Explorer view, double-click your Java class to open the file in the Java editor.
- Click the Annotations view tab.
- Select the Java element to which you want to add an annotation.
- Click Add annotation.
- In the Add annotation page, select the annotation that
you want to add:
- To filter the annotations, type a letter or term into the type
filter text field. You can use "*", "?", or camel case:
- Select the annotation that you want to insert into your Java class, and click OK
- You see in the Java class the @Stateless annotation is added to your code.
- When you press CTRL+S to save, you can see a quick fix
icon
next to the @Stateless line
- Right-click the quick fix icon and select Quick
Fix:
- Select Import 'Stateless' (javax.ejb) and
press CTRL+S to save:
- You see in the Java class that your annotation is added to the code. Highlight the annotation, and the details for this annotation appear in the Annotation view.
- The attributes pane shows both the default values (which you can change) and assigned values.