src/share/classes/java/lang/annotation/Target.java

Print this page




  50  *        ...
  51  *    }
  52  * </pre>
  53  * It is a compile-time error for a single ElementType constant to
  54  * appear more than once in a Target annotation.  For example, the
  55  * following meta-annotation is illegal:
  56  * <pre>
  57  *    &#064;Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
  58  *    public &#064;interface Bogus {
  59  *        ...
  60  *    }
  61  * </pre>
  62  *
  63  * @since 1.5
  64  * @jls 9.6.3.1 @Target
  65  */
  66 @Documented
  67 @Retention(RetentionPolicy.RUNTIME)
  68 @Target(ElementType.ANNOTATION_TYPE)
  69 public @interface Target {






  70     ElementType[] value();
  71 }


  50  *        ...
  51  *    }
  52  * </pre>
  53  * It is a compile-time error for a single ElementType constant to
  54  * appear more than once in a Target annotation.  For example, the
  55  * following meta-annotation is illegal:
  56  * <pre>
  57  *    &#064;Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
  58  *    public &#064;interface Bogus {
  59  *        ...
  60  *    }
  61  * </pre>
  62  *
  63  * @since 1.5
  64  * @jls 9.6.3.1 @Target
  65  */
  66 @Documented
  67 @Retention(RetentionPolicy.RUNTIME)
  68 @Target(ElementType.ANNOTATION_TYPE)
  69 public @interface Target {
  70     /**
  71      * Returns an array of the kinds of elements an annotation type
  72      * can be applied to.
  73      * @return an array of the kinds of elements an annotation type
  74      * can be applied to
  75      */
  76     ElementType[] value();
  77 }