1 /* 2 * Copyright 2009 Werner Guttmann 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 * in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the License 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 * or implied. See the License for the specific language governing permissions and limitations under 12 * the License. 13 */ 14 package org.castor.core.annotationprocessing; 15 16 import java.lang.annotation.Annotation; 17 import java.lang.reflect.AnnotatedElement; 18 import java.lang.reflect.Field; 19 20 import org.castor.core.nature.BaseNature; 21 22 /** 23 * The interface each specific target-aware annotation processor has to fulfill. 24 * 25 * @see AnnotationProcessor 26 * @author Alexander Eibner, Peter Schmidt 27 * @since 1.3.1 28 */ 29 public interface TargetAwareAnnotationProcessor extends AnnotationProcessor { 30 31 /** 32 * The processing action of this processor. If an annotation is given which is not supported false 33 * is returned. 34 * 35 * @param info the Info class that should be filled with the information read 36 * @param annotation the annotation to process 37 * @param target the target ({@link Field}, {@link Class}, etc.) of the given annotation 38 * @return true, if the annotation was processed successfully, false if not 39 * @throws AnnotationTargetException if an annotation is used in a context that is not valid. 40 * @see AnnotatedElement 41 */ 42 <I extends BaseNature, A extends Annotation> boolean processAnnotation(I info, final A annotation, 43 final AnnotatedElement target) throws AnnotationTargetException; 44 45 }