1. /*
  2. * @(#)AnnotationValue.java 1.6 04/07/19
  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 com.sun.mirror.util.SourcePosition;
  9. /**
  10. * Represents a value of an annotation type element.
  11. *
  12. * @author Joseph D. Darcy
  13. * @author Scott Seligman
  14. * @version 1.6 04/07/19
  15. * @since 1.5
  16. */
  17. public interface AnnotationValue {
  18. /**
  19. * Returns the value.
  20. * The result has one of the following types:
  21. * <ul><li> a wrapper class (such as {@link Integer}) for a primitive type
  22. * <li> {@code String}
  23. * <li> {@code TypeMirror}
  24. * <li> {@code EnumConstantDeclaration}
  25. * <li> {@code AnnotationMirror}
  26. * <li> {@code Collection<AnnotationValue>}
  27. * (representing the elements, in order, if the value is an array)
  28. * </ul>
  29. *
  30. * @return the value
  31. */
  32. Object getValue();
  33. /**
  34. * Returns the source position of the beginning of this annotation value.
  35. * Returns null if the position is unknown or not applicable.
  36. *
  37. * <p>This source position is intended for use in providing diagnostics,
  38. * and indicates only approximately where an annotation value begins.
  39. *
  40. * @return the source position of the beginning of this annotation value or
  41. * null if the position is unknown or not applicable
  42. */
  43. SourcePosition getPosition();
  44. /**
  45. * Returns a string representation of this value.
  46. * This is returned in a form suitable for representing this value
  47. * in the source code of an annotation.
  48. *
  49. * @return a string representation of this value
  50. */
  51. String toString();
  52. }