1. /*
  2. * @(#)AnnotationMirror.java 1.5 04/07/16
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.mirror.declaration;
  8. import java.util.Map;
  9. import com.sun.mirror.type.AnnotationType;
  10. import com.sun.mirror.util.SourcePosition;
  11. /**
  12. * Represents an annotation. An annotation associates a value with
  13. * each element of an annotation type.
  14. *
  15. * <p> Annotations should not be compared using reference-equality
  16. * ("<tt>==</tt>"). There is no guarantee that any particular
  17. * annotation will always be represented by the same object.
  18. *
  19. * @author Joseph D. Darcy
  20. * @author Scott Seligman
  21. * @version 1.5 04/07/16
  22. * @since 1.5
  23. */
  24. public interface AnnotationMirror {
  25. /**
  26. * Returns the annotation type of this annotation.
  27. *
  28. * @return the annotation type of this annotation
  29. */
  30. AnnotationType getAnnotationType();
  31. /**
  32. * Returns the source position of the beginning of this annotation.
  33. * Returns null if the position is unknown or not applicable.
  34. *
  35. * <p>This source position is intended for use in providing diagnostics,
  36. * and indicates only approximately where an annotation begins.
  37. *
  38. * @return the source position of the beginning of this annotation or
  39. * null if the position is unknown or not applicable
  40. */
  41. SourcePosition getPosition();
  42. /**
  43. * Returns this annotation's elements and their values.
  44. * This is returned in the form of a map that associates elements
  45. * with their corresponding values.
  46. * Only those elements and values explicitly present in the
  47. * annotation are included, not those that are implicitly assuming
  48. * their default values.
  49. * The order of the map matches the order in which the
  50. * elements appear in the annotation's source.
  51. *
  52. * @return this annotation's elements and their values,
  53. * or an empty map if there are none
  54. */
  55. Map<AnnotationTypeElementDeclaration, AnnotationValue> getElementValues();
  56. }