View Javadoc
1   /*
2    * Copyright 2007 Joachim Grueneis
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  
18  import org.castor.core.nature.BaseNature;
19  
20  /**
21   * The interface each specific annotation processor has to fulfill.
22   * 
23   * @author Joachim Grueneis
24   * @since 1.3
25   */
26  public interface AnnotationProcessor {
27  
28    /**
29     * Returns for which Annotation this processor is meant.
30     * 
31     * @return the Class for which this processor is meant
32     */
33    Class<? extends Annotation> forAnnotationClass();
34  
35    /**
36     * The processing action of this processor. If an annotation is given which is not supported false
37     * is returned.
38     * 
39     * @param info the Info class that should be filled with the information read
40     * @param annotation the annotation to process
41     * @return true, if the annotation was processed successfully, false if not
42     */
43    <I extends BaseNature, A extends Annotation> boolean processAnnotation(I info,
44        final A annotation);
45  }