Analista De Sistemas

Páginas: 4 (991 palabras) Publicado: 8 de agosto de 2012
Java Annotations
Annotations provide data about a program that is not part of the program itself. They have no direct effect on the operation of the code they annotate.
Annotations have a number ofuses, among them:
• Information for the compiler — Annotations can be used by the compiler to detect errors or suppress warnings.
• Compiler-time and deployment-time processing — Software tools canprocess annotation information to generate code, XML files, and so forth.
• Runtime processing — Some annotations are available to be examined at runtime.
Annotations can be applied to a program'sdeclarations of classes, fields, methods, and other program elements.
The annotation appears first, often (by convention) on its own line, and may include elements with named or unnamed values:@Author(
name = "Benjamin Franklin",
date = "3/27/2003"
)
class MyClass() { }
or
@SuppressWarnings(value = "unchecked")
void myMethod() { }
If there is just one element named "value," thenthe name may be omitted, as in:
@SuppressWarnings("unchecked")
void myMethod() { }
Also, if an annotation has no elements, the parentheses may be omitted, as in:
@Override
void mySuperMethod() { }Documentation
Many annotations replace what would otherwise have been comments in code.
Suppose that a software group has traditionally begun the body of every class with comments providingimportant information:
public class Generation3List extends Generation2List {

// Author: John Doe
// Date: 3/17/2002
// Current revision: 6
// Last modified: 4/12/2004
// By: Jane Doe// Reviewers: Alice, Bill, Cindy

// class code goes here

}
To add this same metadata with an annotation, you must first define the annotation type. The syntax for doing this is:@interface ClassPreamble {
String author();
String date();
int currentRevision() default 1;
String lastModified() default "N/A";
String lastModifiedBy() default "N/A";
// Note use...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Analista De Sistemas
  • Analista En Sistemas
  • Analista de Sistemas
  • analista de sistemas
  • Analista de Sistemas
  • Analista de sistemas
  • Analista De Sistemas
  • Analista De Sistemas

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS