April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Anotações (Java Annotations)
nExemplo anotações para documentação – declaração :
nimport java.lang.annotation.*; // import this to use @Documented
n@Documented                    // anotação de documentação
n@interface ClassPreamble {
n  String author();
n  String date();
n  int currentRevision() default 1;
n  String lastModified() default "N/A";
n  String lastModifiedBy() default "N/A";
n  String[] reviewers(); // Note use of array
n}
nuso da anotação no código fonte:
n@ClassPreamble {
n  author = "John Doe", date = "3/17/2002",
n  currentRevision = 6, lastModified = "4/12/2004",
n  lastModifiedBy = "Jane Doe“,
n  reviewers = {"Alice", "Bob", "Cindy"} // Note array notation
n}
npublic class Generation3List extends Generation2List { //class code... }