1 /* 2 * @(#)AnnotationValue.java 1.4 06/07/31 3 * 4 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package javax.lang.model.element; 9 10 11 import java.util.List; 12 import javax.lang.model.type.*; 13 14 /** 15 * Represents a value of an annotation type element. 16 * A value is of one of the following types: 17 * <ul><li> a wrapper class (such as {@link Integer}) for a primitive type 18 * <li> {@code String} 19 * <li> {@code TypeMirror} 20 * <li> {@code VariableElement} (representing an enum constant) 21 * <li> {@code AnnotationMirror} 22 * <li> {@code List<? extends AnnotationValue>} 23 * (representing the elements, in declared order, if the value is an array) 24 * </ul> 25 * 26 * @author Joseph D. Darcy 27 * @author Scott Seligman 28 * @author Peter von der Ahé 29 * @version 1.4 06/07/31 30 * @since 1.6 31 */ 32 public interface AnnotationValue { 33 34 /** 35 * Returns the value. 36 * 37 * @return the value 38 */ 39 Object getValue(); 40 41 /** 42 * Returns a string representation of this value. 43 * This is returned in a form suitable for representing this value 44 * in the source code of an annotation. 45 * 46 * @return a string representation of this value 47 */ 48 String toString(); 49 50 /** 51 * Applies a visitor to this value. 52 * 53 * @param <R> the return type of the visitor's methods 54 * @param <P> the type of the additional parameter to the visitor's methods 55 * @param v the visitor operating on this value 56 * @param p additional parameter to the visitor 57 * @return a visitor-specified result 58 */ 59 <R, P> R accept(AnnotationValueVisitor<R, P> v, P p); 60 } 61