Professional Documents
Culture Documents
Annotations, a form of metadata, provide data about a program that is not part
of the program itself. Annotations have no direct effect on the operation of the
code they annotate.
Java annotations are used to provide meta data for your Java code. Being meta
data, the annotations do not directly affect the execution of your code, although
some types of annotations can actually be used for that purpose.
Compiler instructions
Build-time instructions
Runtime instructions
Java has 3 built-in annotations that you can use to give instructions to the Java
compiler.
Annotation Basics
@Entity
Annotations can have elements for which you can set values. An element is like
an attribute or parameter. Here is an example of an annotation with an element:
@Entity(tableName = "vehicles")
@InsertNew(value = "yes")
When an annotation just contains a single element named value, you can leave
out the element name, and just provide the value. Here is an example:
@InsertNew("yes")