You can add annotations in your source code by using the
Annotations view.
Before you begin
In the Java™ EE
perspective, if the Annotations view does not appear in the bottom
of the workspace, you need to add the Annotations view. For more information,
see
Using the Annotations view.
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
that you want to add an annotation to.
- 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 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
beside 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.