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