Tag Archives: Annotation

Build your own Annotation processor using Java6 – Part 1

After previous post we all understood basic Annotation’s terms, how to custom it, how to retrieve it at Runtime by reflection. To day, i’m going more deeply, such a writing Annotation processor, and integrate it with eclipse to reuse in a sample Android project.

Java SE5 provides a command-line utility for annotation processing, call Annotation processing tool or apt. It contains a set of reflective APIs and supporting infrastructure to process program annotations.

Since Java SE7, the apt tool and tis associated API have been deprecated, and are planned to be removed in next JDK release. Instead of it, use javac tool and APIs contained in the packages javax.annotation.processing and javax.lang.model to process annotations.

Continue reading

Exploring for Java Annotation

1. Introduction

Annotations, called metadata, is additional information that embed into java source code file, and it can be used by complilers or developement tools for some purposes :

Informations for compiler. Annotations can be used by compiler to detect errors or superess warning.

Compile-time and deployment-time processing. IDEs can use annatations to generate code, XML file, ….

Runtime processing. Some annotations ‘re available to retrieve at runtime. Continue reading