01: /*
02: * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun in the LICENSE file that accompanied this code.
10: *
11: * This code is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * version 2 for more details (a copy is included in the LICENSE file that
15: * accompanied this code).
16: *
17: * You should have received a copy of the GNU General Public License version
18: * 2 along with this work; if not, write to the Free Software Foundation,
19: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25:
26: package javax.lang.model.element;
27:
28: import java.util.List;
29: import javax.lang.model.type.*;
30:
31: /**
32: * Represents a value of an annotation type element.
33: * A value is of one of the following types:
34: * <ul><li> a wrapper class (such as {@link Integer}) for a primitive type
35: * <li> {@code String}
36: * <li> {@code TypeMirror}
37: * <li> {@code VariableElement} (representing an enum constant)
38: * <li> {@code AnnotationMirror}
39: * <li> {@code List<? extends AnnotationValue>}
40: * (representing the elements, in declared order, if the value is an array)
41: * </ul>
42: *
43: * @author Joseph D. Darcy
44: * @author Scott Seligman
45: * @author Peter von der Ahé
46: * @version 1.10 07/05/05
47: * @since 1.6
48: */
49: public interface AnnotationValue {
50:
51: /**
52: * Returns the value.
53: *
54: * @return the value
55: */
56: Object getValue();
57:
58: /**
59: * Returns a string representation of this value.
60: * This is returned in a form suitable for representing this value
61: * in the source code of an annotation.
62: *
63: * @return a string representation of this value
64: */
65: String toString();
66:
67: /**
68: * Applies a visitor to this value.
69: *
70: * @param <R> the return type of the visitor's methods
71: * @param <P> the type of the additional parameter to the visitor's methods
72: * @param v the visitor operating on this value
73: * @param p additional parameter to the visitor
74: * @return a visitor-specified result
75: */
76: <R, P> R accept(AnnotationValueVisitor<R, P> v, P p);
77: }
|