/* * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package com.sun.xml.internal.bind.v2.model.annotation; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.Method; import com.sun.istack.internal.Nullable; import com.sun.xml.internal.bind.v2.model.core.ErrorHandler; /** * Reads annotations for the given property. * *
* This is the lowest abstraction that encapsulates the difference * between reading inline annotations and external binding files. * *
* Because the former operates on a {@link Field} and {@link Method} * while the latter operates on a "property", the methods defined * on this interface takes both, and the callee gets to choose which * to use. * *
* Most of the get method takes {@link Locatable}, which points to * the place/context in which the annotation is read. The returned * annotation also implements {@link Locatable} (so that it can * point to the place where the annotation is placed), and its * {@link Locatable#getUpstream()} will return the given * {@link Locatable}. * * *
* Errors found during reading annotations are reported through the error handler.
* A valid {@link ErrorHandler} must be registered before the {@link AnnotationReader}
* is used.
*
* @author Kohsuke Kawaguchi (kk@kohsuke.org)
*/
public interface AnnotationReader
* Depending on the underlying reflection library, you can't always
* obtain the {@link Class} object directly (see the Annotation Processing MirrorTypeException
* for example), so use this method to avoid that.
*
* @param name
* The name of the annotation parameter to be read.
*/
T getClassValue( Annotation a, String name );
/**
* Similar to {@link #getClassValue(Annotation, String)} method but
* obtains an array parameter.
*/
T[] getClassArrayValue( Annotation a, String name );
}