In programming, a Java Annotation is a way of adding metadata Java source code available for use in runtime . Often used as an alternative to XML technology.
Java Annotations can be added to the program elements such as classes, methods, fields, parameters, local variables, and packages. Unlike tags added to the Java documentation and processed with tools such as XDoclet , Java Annotations are fully accessible to the programmer while the software is executed using reflection .
Annotations take the form of an interface declaration with a @ character preceding it, and optionally labeled with meta-annotations, as shown below:
@ Retention (RetentionPolicy.RUNTIME)
@ Target ({} ElementType.METHOD )
The annotations allow the programmer to declare its source code
how software should behave. This is an example of how the constructs
Declarative programming can be added to the procedural language.
0 comments:
Post a Comment