AnnotatedElement.java revision 1578
0N/A * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * Represents an annotated element of the program currently running in this 0N/A * VM. This interface allows annotations to be read reflectively. All 0N/A * annotations returned by methods in this interface are immutable and 0N/A * serializable. It is permissible for the caller to modify the 0N/A * arrays returned by accessors for array-valued enum members; it will 0N/A * have no affect on the arrays returned to other callers. 0N/A * <p>If an annotation returned by a method in this interface contains 0N/A * (directly or indirectly) a {@link Class}-valued member referring to 0N/A * a class that is not accessible in this VM, attempting to read the class 0N/A * by calling the relevant Class-returning method on the returned annotation 0N/A * will result in a {@link TypeNotPresentException}. 0N/A * <p>Similarly, attempting to read an enum-valued member will result in 0N/A * a {@link EnumConstantNotPresentException} if the enum constant in the 0N/A * annotation is no longer present in the enum type. 0N/A * <p>Finally, Attempting to read a member whose definition has evolved 0N/A * incompatibly will result in a {@link 0N/A * java.lang.annotation.AnnotationTypeMismatchException} or an 0N/A * {@link java.lang.annotation.IncompleteAnnotationException}. 1578N/A * @see java.lang.EnumConstantNotPresentException 1578N/A * @see java.lang.TypeNotPresentException 1578N/A * @see java.lang.annotation.AnnotationFormatError 1578N/A * @see java.lang.annotation.AnnotationTypeMismatchException 1578N/A * @see java.lang.annotation.IncompleteAnnotationException 0N/A * @author Josh Bloch 0N/A * Returns true if an annotation for the specified type 0N/A * is present on this element, else false. This method 0N/A * is designed primarily for convenient access to marker annotations. 0N/A * @param annotationClass the Class object corresponding to the 0N/A * @return true if an annotation for the specified annotation 0N/A * type is present on this element, else false 0N/A * @throws NullPointerException if the given annotation class is null 0N/A * Returns this element's annotation for the specified type if 0N/A * such an annotation is present, else null. 0N/A * @param annotationClass the Class object corresponding to the 0N/A * @return this element's annotation for the specified annotation type if 0N/A * present on this element, else null 0N/A * @throws NullPointerException if the given annotation class is null 0N/A * Returns all annotations present on this element. (Returns an array 0N/A * of length zero if this element has no annotations.) The caller of 0N/A * this method is free to modify the returned array; it will have no 0N/A * effect on the arrays returned to other callers. 0N/A * @return all annotations present on this element 0N/A * Returns all annotations that are directly present on this 0N/A * element. Unlike the other methods in this interface, this method 0N/A * ignores inherited annotations. (Returns an array of length zero if 0N/A * no annotations are directly present on this element.) The caller of 0N/A * this method is free to modify the returned array; it will have no 0N/A * effect on the arrays returned to other callers. 0N/A * @return All annotations directly present on this element