Annotation-based programming overview

Annotation-based programming is one of the tools that WebSphere® Rapid Deployment (WRD) application uses to provide 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. Annotation-based programming 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

WRD supports annotations using Javadoc-style comments within the Java source file. You may include annotations in the package, class, field, or method declarations. In addition, WRD supports the tag syntax of XDoclet where it exists. For more information on XDoclet, see http://xdoclet.sourceforge.net/xdoclet/index.html.

WRD supports many tags that help you build your applications. These tags map directly to known J2EE artifacts and deployment descriptor elements. Specifically, WRD supports 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.
Terms of use | Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.