Java Annotations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 7: Line 7:
=Custom Annotations=
=Custom Annotations=


Annotation type declarations are similar to normal interface declarations. An at-sign (@) precedes the interface keyword. Each method declaration defines an element of the annotation type. Method declarations must not have any parameters or a throws clause. Return types are restricted to primitives, String, Class, enums, annotations, and arrays of the preceding types. Methods can have default values.
Annotation type declarations are similar to normal interface declarations. An at-sign (@) precedes the interface keyword.  
 
Each method declaration defines an element of the annotation type. Method declarations must not have any parameters or a throws clause. Return types are restricted to primitives, String, Class, enums, annotations, and arrays of the preceding types.  
 
Methods can have default values.

Revision as of 02:59, 1 November 2018

Internal

Overview

Custom Annotations

Annotation type declarations are similar to normal interface declarations. An at-sign (@) precedes the interface keyword.

Each method declaration defines an element of the annotation type. Method declarations must not have any parameters or a throws clause. Return types are restricted to primitives, String, Class, enums, annotations, and arrays of the preceding types.

Methods can have default values.