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