1. /*
  2. * @(#)Target.java 1.5 04/06/22
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.lang.annotation;
  8. /**
  9. * Indicates the kinds of program element to which an annotation type
  10. * is applicable. If a Target meta-annotation is not present on an
  11. * annotation type declaration, the declared type may be used on any
  12. * program element. If such a meta-annotation is present, the compiler
  13. * will enforce the specified usage restriction.
  14. *
  15. * For example, this meta-annotation indicates that the declared type is
  16. * itself a meta-annotation type. It can only be used on annotation type
  17. * declarations:
  18. * <pre>
  19. * @Target(ElementType.ANNOTATION_TYPE)
  20. * public @interface MetaAnnotationType {
  21. * ...
  22. * }
  23. * </pre>
  24. * This meta-annotation indicates that the declared type is intended solely
  25. * for use as a member type in complex annotation type declarations. It
  26. * cannot be used to annotate anything directly:
  27. * <pre>
  28. * @Target({})
  29. * public @interface MemberType {
  30. * ...
  31. * }
  32. * </pre>
  33. * It is a compile-time error for a single ElementType constant to
  34. * appear more than once in a Target annotation. For example, the
  35. * following meta-annotation is illegal:
  36. * <pre>
  37. * @Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
  38. * public @interface Bogus {
  39. * ...
  40. * }
  41. * </pre>
  42. */
  43. @Documented
  44. @Retention(RetentionPolicy.RUNTIME)
  45. @Target(ElementType.ANNOTATION_TYPE)
  46. public @interface Target {
  47. ElementType[] value();
  48. }