Monday, February 18, 2008

Creating an Annotation

See the JavaDocs - Annotation Interface Annotation Type Target
import java.lang.annotation.*;

   @Target(ElementType.METHOD)

   public @interface Test_Target {
      public String doTestTarget();
   }

public class TestAnnotations {

   public static void main(String arg[]) {
      new TestAnnotations().doTestTarget();
   }


   @Test_Target(doTestTarget="Hello World !")
   public void doTestTarget() {
      System.out.printf("Testing Target annotation");
   }
}