is one more powerful feature of Java, an object-oriented programming
language included in JDK 1.5. Annotations
were introduced in
September 2004 and added to the Java language through specification.
It is a way of adding the
informative data to Java source code or to the Java elements like Classes,
Interfaces or Enums that can also be available for the programmer at run-time that
is not actually part of the program.
After adding annotation by Sun Microsystem, it is
very easy to make the development of program as well as efficient in jdk 5.
Annotations behave like the meta-data where the literal meaning of meta-data is
data about data. Java also signifies this meaning. Annotations can also apply on
variables, parameter, field type declarations, methods and constructors.
Annotation is also used to create the documentation to perform rudimentary
compile time checking and even for tracking down the dependencies in code.
XDoclet contains all these features and is widely used.
Fundamentals of annotations
An annotation type definition appends an "at" @ sign at the start of the interface keyword with the annotation name. On the other hand, an annotation includes the "at" @ sign followed by the annotation type. You can also add the data within the parenthesis after the annotation name.
First of all before going through the annotations we should consider two things. The first one is the "annotation" itself and second one is the "annotations types". An annotation is the meta tag, used to give some life to the code you are using. While annotation type is used to define annotations so that you can use them while creating your own custom annotations.
For detailed information about annotation just visit on Annotation in brief:
Liked it! Share this Tutorial