Adding annotations manually

You can add annotations in your source code by directly adding the annotation in the Java™ editor.

Procedure

  1. In the Enterprise Explorer view, double-click your Java class to open the file in the Java editor.
  2. Place your cursor in the section of your class (class level, method level) where you want to add an annotation.
  3. Type the symbol @ followed by the name of your annotation:
    @Session
    @Interceptors
    Note: The order in which you place the annotations is not significant, though generally, the component-defining annotation appears before other types of annotations. What is important is that annotations are placed in the appropriate place in the source file; class-level annotations must appear before the class declaration; method-level annotations are introduced before the method declaration, and field-level annotations are applied to the field itself.
  4. If the annotation requires parameters, an error appears in the margin. You can right-click the error and select Quick Fix (quick fix icon) to import required jars or to add required parameters.
Icon that indicates the type of topic Task topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: taddannoman.html