· java


An annotation is a form of syntactic metadata that can be added to Java source code.
Classes, methods, variables, parameters and Java packages may be annotated.

―Replacement of marker interfaces:

―Better metadata management:

Creating an annotation

Annotations require:
1) A target: this defines where the annotation can be set
2) A retention: this describes up to which step in the compilation process the annotation will be available

Annotation parameters

Annotations can define parameters.
Parameters allow to add some level of configuration at the time the annotation is used.