O'Reilly logo

Java Enterprise in a Nutshell, Third Edition by William Crawford, Jim Farley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

J2SE Annotations Tutorial

J2SE 5.0 introduced a standard, generalized annotation model to the Java language itself. J2SE annotations are an actual part of the Java language syntax, with annotations inserted directly into your code (not just within comments, as you do with Javadoc tags). These annotations can be processed using a standard annotation processing tool provided with J2SE 5.0 environments, or you can write your own Java code to access and process annotations.

J2SE annotations differ from XDoclet annotations in two key ways. First, J2SE annotations are part of the actual language syntax. These annotations are supported directly by Java compilers, and new annotations are defined much like new classes and interfaces, using Java interface-like declarations.

The other difference is a temporary one. At this writing, the general infrastructure for defining and using J2SE annotations has been introduced in Java 5.0, and a few standard annotations are part of the core Java API. Annotations and processing tools based on J2SE annotations aimed at enterprise development (e.g., generating deployment descriptors or code artifacts for components) are still in development, as part of the next round of specifications in the web, EJB, and web services spaces, among others.

In the meantime, and even after these standard enterprise annotations are available, XDoclet and J2SE annotations are complementary tools that you can use together to ease the development and management of enterprise systems. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required