summaryrefslogtreecommitdiff
path: root/javax/lang/model/element/AnnotationMirror.java
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2012-11-27 04:08:20 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2012-11-27 04:08:20 +0000
commit449a0b97ab63a4bff26ae281322fc3afaab16569 (patch)
tree0eec62720551c4a9709c8f961be12c2466fa3543 /javax/lang/model/element/AnnotationMirror.java
parent75fab280b83e1d86b396276da8e1e5b1ec6c0169 (diff)
downloadclasspath-449a0b97ab63a4bff26ae281322fc3afaab16569.tar.gz
Add annotation elements and start of type hierarchy.
2012-11-26 Andrew John Hughes <gnu_andrew@member.fsf.org> * javax/lang/model/element/AnnotationMirror.java: Added. (getAnnotationType()): Added. (getElementValues()): Likewise. * javax/lang/model/element/AnnotationValue.java: Added. (accept(AnnotationValueVisitor,P)): Added. (getValue()): Likewise. (toString()): Likewise. * javax/lang/model/element/AnnotationValueVisitor.java: Added. (visit(AnnotationValue)): Added. (visit(AnnotationValue, P)): Likewise. (visitAnnotation(AnnotationMirror, P)): Likewise. (visitArray(List, P)): Likewise. (visitBoolean(boolean, P)): Likewise. (visitByte(byte, P)): Likewise. (visitChar(char, P)): Likewise. (visitDouble(double, P)): Likewise. (visitEnumConstant(VariableElement, P)): Likewise. (visitFloat(float, P)): Likewise. (visitInt(float, P)): Likewise. (visitLong(long, P)): Likewise. (visitShort(short, P)): Likewise. (visitString(String, P)): Likewise. (visitType(TypeMirror, P)): Likewise. (visitUnknown(AnnotationValue, P)): Likewise. * javax/lang/model/element/Element.java: (asType()): Added. (getAnnotationMirrors()): Likewise. * javax/lang/model/element/ElementVisitor.java: (visitExecutable(ExecutableElement, P)): Added. (visitTypeParameter(TypeParameterElement, P)): Likewise. (visitVariable(VariableElement, P)): Likewise. * javax/lang/model/element/ExecutableElement.java: Added. (getDefaultValue()): Added. (getParameters()): Likewise. (getReturnType()): Likewise. (getThrownTypes()): Likewise. (getTypeParameters()): Likewise. (isVarArgs()): Likewise. * javax/lang/model/element/TypeElement.java: (getInterfaces()): Added. (getSuperclass()): Likewise. (getTypeParameters()): Likewise. * javax/lang/model/element/TypeParameterElement.java: Added. (getBounds()): Added. (getGenericElement()): Likewise. * javax/lang/model/element/VariableElement.java: Added. (getConstantValue()): Added. * javax/lang/model/type/DeclaredType.java: Added. (asElement()): Added. (getEnclosingType()): Likewise. (getTypeArguments()): Likewise. * javax/lang/model/type/ReferenceType.java: Added. * javax/lang/model/type/TypeKind.java: Added. (ARRAY): Added. (BOOLEAN): Likewise. (BYTE): Likewise. (CHAR): Likewise. (DECLARED): Likewise. (DOUBLE): Likewise. (ERROR): Likewise. (EXECUTABLE): Likewise. (FLOAT): Likewise. (INT): Likewise. (LONG): Likewise. (NONE): Likewise. (NULL): Likewise. (OTHER): Likewise. (PACKAGE): Likewise. (SHORT): Likewise. (TYPEVAR): Likewise. (VOID): Likewise. (WILDCARD): Likewise. (isPrimitive()): Implemented. * javax/lang/model/type/TypeMirror.java: Added. (accept(TypeVisitor, P)): Added. (equals(Object)): Likewise. (getKind()): Likewise. (hashCode()): Likewise. (toString()): Likewise. * javax/lang/model/type/TypeVisitor.java: Added. (visit(TypeMirror)): Added. (visit(TypeMirror, P)): Likewise. (visitUnknown(TypeMirror, P)): Likewise. (visitDeclared(DeclaredType, P)): Likewise. * javax/lang/model/util/Elements.java: (getAllAnnotationMirrors(Element)): Added. (getElementValuesWithDefaults(AnnotationMirror)): Likewise. (overrides(ExecutableElement, ExecutableElement)): Likewise. * javax/lang/model/util/Types.java: (asElement(TypeMirror)): Added. (asMemberOf(DeclaredType, Element)): Likewise. (capture(TypeMirror)): Likewise. (contains(TypeMirror, TypeMirror)): Likewise. (directSupertypes(TypeMirror)): Likewise. (erasure(TypeMirror)): Likewise. (getDeclaredType(DeclaredType, TypeElement, TypeMirror...)): Likewise. (getDeclaredType(TypeElement, TypeMirror...)): Likewise. (isAssignable(TypeMirror, TypeMirror)): Likewise. (isSameType(TypeMirror, TypeMirror)): Likewise. (isSubtype(TypeMirror, TypeMirror)): Likewise. Signed-off-by: Andrew John Hughes <gnu_andrew@member.fsf.org>
Diffstat (limited to 'javax/lang/model/element/AnnotationMirror.java')
-rw-r--r--javax/lang/model/element/AnnotationMirror.java78
1 files changed, 78 insertions, 0 deletions
diff --git a/javax/lang/model/element/AnnotationMirror.java b/javax/lang/model/element/AnnotationMirror.java
new file mode 100644
index 000000000..eeaf688e8
--- /dev/null
+++ b/javax/lang/model/element/AnnotationMirror.java
@@ -0,0 +1,78 @@
+/* AnnotationMirror.java -- Represents an annotation.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.lang.model.element;
+
+import java.util.Map;
+
+import javax.lang.model.type.DeclaredType;
+
+/**
+ * Represents an annotation. An annotation associates values
+ * with the elements of an annotation type. Annotations should
+ * be compared using {@link #equals(Object)}. There is no guarantee
+ * that the same annotation is always represented by the same
+ * instance.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.6
+ */
+public interface AnnotationMirror
+{
+
+ /**
+ * Returns the type of this annotation.
+ *
+ * @return the type of this annotation.
+ */
+ DeclaredType getAnnotationType();
+
+ /**
+ * Returns a map of elements to their values. Only those
+ * elements explicitly set in the annotation are present;
+ * default values are not included. To obtain the default
+ * values as well, use
+ * {@link javax.lang.model.util.Elements#getElementValuesWithDefaults(AnnotationMirror)}
+ * A marker annotation, by definition, returns an empty map.
+ * The order of the elements in the map follows that of the
+ * source code.
+ *
+ * @return the map of elements to values.
+ */
+ Map<? extends ExecutableElement, ? extends AnnotationValue> getElementValues();
+
+}