01: /*
02: * Copyright 2004 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 com.sun.mirror.declaration;
27:
28: import java.util.Map;
29: import com.sun.mirror.type.AnnotationType;
30: import com.sun.mirror.util.SourcePosition;
31:
32: /**
33: * Represents an annotation. An annotation associates a value with
34: * each element of an annotation type.
35: *
36: * <p> Annotations should not be compared using reference-equality
37: * ("<tt>==</tt>"). There is no guarantee that any particular
38: * annotation will always be represented by the same object.
39: *
40: * @author Joseph D. Darcy
41: * @author Scott Seligman
42: * @version 1.12 07/05/05
43: * @since 1.5
44: */
45:
46: public interface AnnotationMirror {
47:
48: /**
49: * Returns the annotation type of this annotation.
50: *
51: * @return the annotation type of this annotation
52: */
53: AnnotationType getAnnotationType();
54:
55: /**
56: * Returns the source position of the beginning of this annotation.
57: * Returns null if the position is unknown or not applicable.
58: *
59: * <p>This source position is intended for use in providing diagnostics,
60: * and indicates only approximately where an annotation begins.
61: *
62: * @return the source position of the beginning of this annotation or
63: * null if the position is unknown or not applicable
64: */
65: SourcePosition getPosition();
66:
67: /**
68: * Returns this annotation's elements and their values.
69: * This is returned in the form of a map that associates elements
70: * with their corresponding values.
71: * Only those elements and values explicitly present in the
72: * annotation are included, not those that are implicitly assuming
73: * their default values.
74: * The order of the map matches the order in which the
75: * elements appear in the annotation's source.
76: *
77: * @return this annotation's elements and their values,
78: * or an empty map if there are none
79: */
80: Map<AnnotationTypeElementDeclaration, AnnotationValue> getElementValues();
81: }
|