Annotation-based programming overview

Annotation-based programming is an extensible mechanism for generating application artifacts, packaging the application, and readying the application for execution. Annotation-based programming offers a set of tags and a processing mechanism that allow you to embed additional metadata in your Java™ source code. Your application then uses this additional metadata to derive the artifacts required to execute the application in a J2EE environment.

Goal of annotation-based programming

The goal of annotation-based programming is to minimize the number of artifacts that you have to create and maintain, thereby simplifying the development process.

For example, consider a stateless session EJB. With annotation-based programming, you simply create a single Java source file containing the bean implementation logic, and a few tags indicating that you want to deploy this class as an EJB and indicating which methods should be made public on the interface of the EJB. Using this single artifact, WebSphere® Rapid Deployment can create:
All you have to deal with is a single Java artifact. The code for the session EJB example may look like this:
/**
 * @ejb.interface-method view-type=remote
*/
public String hello(String name)
{
  return "Hello: " + name;
}

where @ejb.interface-method view-type=remote is an example of an annotation tag.

Annotation Tags

Annotations are Javadoc-style comments that you embed within the Java source file. You may include annotations in the package, class, field, or method declarations. In addition, the tag syntax of XDoclet is supported. For more information, see XDoclet.

Annotation tags map directly to known J2EE artifacts and deployment descriptor elements, including tags for the following artifact types and generation targets:
Note:
The XDoclet Documentation included in this IBM® product is used with permission and is covered under the following copyright attribution statement: Copyright (c) 2000-2004, XDoclet Team. All rights reserved.
Related tasks
Viewing relationship information in a table
Exporting relationship information
Viewing relationships in a diagram
Viewing relationships in a topic diagram
Viewing relationship issues
Viewing and analyzing model element relationships

Feedback