blob: 029ce1ac9546bd0e88d04b2386fe1b304c53ad27 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: IBM Corporation - initial API and implementation" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="concept" name="DC.Type" />
<meta name="DC.Title" content="Java EE 5 support for annotations" />
<meta name="abstract" content="The goal of Java EE 5 platform development is to minimize the number of artifacts that you have to create and maintain, thereby simplifying the development process. Java EE 5 supports the injection of annotations into your source code, so that you can embed resources, dependencies, services, and life-cycle notifications in your source code, without having to maintain these artifacts elsewhere." />
<meta name="description" content="The goal of Java EE 5 platform development is to minimize the number of artifacts that you have to create and maintain, thereby simplifying the development process. Java EE 5 supports the injection of annotations into your source code, so that you can embed resources, dependencies, services, and life-cycle notifications in your source code, without having to maintain these artifacts elsewhere." />
<meta content="Java EE 5, annotations" name="DC.subject" />
<meta content="Java EE 5, annotations" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="../topics/cjavaee5.html" />
<meta scheme="URI" name="DC.Relation" content="../topics/tdefiningannotations.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="cjavaee5" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
<title>Java EE 5 support for annotations</title>
</head>
<body id="cjavaee5"><a name="cjavaee5"><!-- --></a>
<h1 class="id_title">Java EE 5 support for annotations</h1>
<div><p class="id_shortdesc">The goal of Java™ EE 5 platform development is to minimize
the number of artifacts that you have to create and maintain, thereby simplifying
the development process. Java EE 5 supports the injection of annotations
into your source code, so that you can embed resources, dependencies, services,
and life-cycle notifications in your source code, without having to maintain
these artifacts elsewhere.</p>
<p>An annotation is a modifier or Metadata tag that provides additional data
to Java classes,
interfaces, constructors, methods, fields, parameters, and local variables.
Annotations replace boilerplate code, common code that is required by certain
applications. For example, an annotation can replace the paired interface
and implementation required for a Web service. Annotations can also replace
additional files that programs require, which are maintained separately. By
using an annotation, this separate file is no longer required. For example,
annotations can replace the need for a separately maintained deployment descriptor
for JavaBeans™. </p>
<div class="p">Annotations<ul>
<li>Replace descriptors for most purposes</li>
<li>Remove the need for marker interfaces (like java.rmi.Remote)</li>
<li>Allow application settings to be visible in the component they affect</li>
</ul>
</div>
<div class="p">Java EE 5 provides annotations for the following tasks, among others:<ul>
<li>Developing Enterprise JavaBean applications</li>
<li>Defining and using Web services</li>
<li>Mapping Java technology classes to XML</li>
<li>Mapping Java technology classes to databases</li>
<li>Mapping methods to operations</li>
<li>Specifying external dependencies</li>
<li>Specirying deployment information, including security attributes</li>
</ul>
</div>
<div class="p">Java EE
5 defines a number of annotations that can be injected into your source code.
To declare an annotation, you simply precede the keyword with an "at" sign
(@). <pre>
package com.ibm.counter;
import javax.ejb.Stateless;
@Stateless
public class CounterBean {
}</pre>
</div>
<p>For more information about the categories of annotations that Java EE
5 supports, see <a href="ctypesofanno.html">Types of annotations</a>.</p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="../topics/tdefiningannotations.html">Defining and using annotations</a></strong><br />
You can use the @Interface annotation to define your own annotation definition.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="../topics/cjavaee5.html" title="The Java EE 5 programming model simplifies the process of creating Java applications.">Developing Java EE 5 Applications</a></div>
</div>
</div>
</body>
</html>