KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > mirror > apt > AnnotationProcessorFactory


1 /*
2  * @(#)AnnotationProcessorFactory.java 1.9 04/07/13
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.mirror.apt;
9
10
11 import java.util.Collection JavaDoc;
12 import java.util.Set JavaDoc;
13
14 import com.sun.mirror.declaration.AnnotationTypeDeclaration;
15
16
17 /**
18  * A factory for creating annotation processors.
19  * Each factory is responsible for creating processors for one or more
20  * annotation types.
21  * The factory is said to <i>support</i> these types.
22  *
23  * <p> Each implementation of an <tt>AnnotationProcessorFactory</tt>
24  * must provide a public no-argument constructor to be used by tools to
25  * instantiate the factory.
26  *
27  * @author Joseph D. Darcy
28  * @author Scott Seligman
29  * @version 1.9 04/07/13
30  * @since 1.5
31  */

32
33 public interface AnnotationProcessorFactory {
34
35     /**
36      * Returns the options recognized by this factory or by any of the
37      * processors it may create.
38      * Only {@linkplain AnnotationProcessorEnvironment#getOptions()
39      * processor-specific} options are included, each of which begins
40      * with <tt>"-A"</tt>. For example, if this factory recognizes
41      * options such as <tt>-Adebug -Aloglevel=3</tt>, it will
42      * return the strings <tt>"-Adebug"</tt> and <tt>"-Aloglevel"</tt>.
43      *
44      * <p> A tool might use this information to determine if any
45      * options provided by a user are unrecognized by any processor,
46      * in which case it may wish to report an error.
47      *
48      * @return the options recognized by this factory or by any of the
49      * processors it may create, or an empty collection if none
50      */

51     Collection JavaDoc<String JavaDoc> supportedOptions();
52
53     /**
54      * Returns the names of the annotation types supported by this factory.
55      * An element of the result may be the canonical (fully qualified) name
56      * of a supported annotation type. Alternately it may be of the form
57      * <tt>"<i>name</i>.*"</tt>
58      * representing the set of all annotation types
59      * with canonical names beginning with <tt>"<i>name</i>."</tt>
60      * Finally, <tt>"*"</tt> by itself represents the set of all
61      * annotation types.
62      *
63      * @return the names of the annotation types supported by this factory
64      */

65     Collection JavaDoc<String JavaDoc> supportedAnnotationTypes();
66
67     /**
68      * Returns an annotation processor for a set of annotation
69      * types. The set will be empty if the factory supports
70      * &quot;<tt>*</tt>&quot; and the specified type declarations have
71      * no annotations. Note that the set of annotation types may be
72      * empty for other reasons, such as giving the factory an
73      * opportunity to register a listener. An
74      * <tt>AnnotationProcessorFactory</tt> must gracefully handle an
75      * empty set of annotations; an appropriate response to an empty
76      * set will often be returning {@link AnnotationProcessors#NO_OP}.
77      *
78      * @param atds type declarations of the annotation types to be processed
79      * @param env environment to use during processing
80      * @return an annotation processor for the given annotation types,
81      * or <tt>null</tt> if the types are not supported or the
82      * processor cannot be created
83      */

84     AnnotationProcessor getProcessorFor(Set JavaDoc<AnnotationTypeDeclaration> atds,
85                     AnnotationProcessorEnvironment env);
86 }
87
Popular Tags