001 /*
002 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package javax.lang.model.element;
027
028 import java.util.Map;
029 import javax.lang.model.type.DeclaredType;
030
031 /**
032 * Represents an annotation. An annotation associates a value with
033 * each element of an annotation type.
034 *
035 * <p> Annotations should be compared using the {@code equals}
036 * method. There is no guarantee that any particular annotation will
037 * always be represented by the same object.
038 *
039 * @author Joseph D. Darcy
040 * @author Scott Seligman
041 * @author Peter von der Ahé
042 * @since 1.6
043 */
044 public interface AnnotationMirror {
045
046 /**
047 * Returns the type of this annotation.
048 *
049 * @return the type of this annotation
050 */
051 DeclaredType getAnnotationType();
052
053 /**
054 * Returns the values of this annotation's elements.
055 * This is returned in the form of a map that associates elements
056 * with their corresponding values.
057 * Only those elements with values explicitly present in the
058 * annotation are included, not those that are implicitly assuming
059 * their default values.
060 * The order of the map matches the order in which the
061 * values appear in the annotation's source.
062 *
063 * <p>Note that an annotation mirror of a marker annotation type
064 * will by definition have an empty map.
065 *
066 * <p>To fill in default values, use {@link
067 * javax.lang.model.util.Elements#getElementValuesWithDefaults
068 * getElementValuesWithDefaults}.
069 *
070 * @return the values of this annotation's elements,
071 * or an empty map if there are none
072 */
073 Map<? extends ExecutableElement, ? extends AnnotationValue> getElementValues();
074 }