31 32 import com.sun.mirror.declaration.*; 33 import com.sun.mirror.util.*; 34 35 36 /** 37 * The environment encapsulating the state needed by an annotation processor. 38 * An annotation processing tool makes this environment available 39 * to all annotation processors. 40 * 41 * <p> When an annotation processing tool is invoked, it is given a 42 * set of type declarations on which to operate. These 43 * are refered to as the <i>specified</i> types. 44 * The type declarations said to be <i>included</i> in this invocation 45 * consist of the specified types and any types nested within them. 46 * 47 * <p> {@link DeclarationFilter} 48 * provides a simple way to select just the items of interest 49 * when a method returns a collection of declarations. 50 * 51 * @author Joseph D. Darcy 52 * @author Scott Seligman 53 * @since 1.5 54 */ 55 56 public interface AnnotationProcessorEnvironment { 57 58 /** 59 * Returns the options passed to the annotation processing tool. 60 * Options are returned in the form of a map from option name 61 * (such as <tt>"-encoding"</tt>) to option value. 62 * For an option with no value (such as <tt>"-help"</tt>), the 63 * corresponding value in the map is <tt>null</tt>. 64 * 65 * <p> Options beginning with <tt>"-A"</tt> are <i>processor-specific.</i> 66 * Such options are unrecognized by the tool, but intended to be used by 67 * some annotation processor. 68 * 69 * @return the options passed to the tool 70 */ 71 Map<String,String> getOptions(); 72 73 /** 74 * Returns the messager used to report errors, warnings, and other 75 * notices. 76 * 77 * @return the messager 78 */ 79 Messager getMessager(); 80 81 /** 82 * Returns the filer used to create new source, class, or auxiliary 83 * files. 84 * 85 * @return the filer 86 */ 87 Filer getFiler(); 88 89 90 91 /** 92 * Returns the declarations of the types specified when the 93 * annotation processing tool was invoked. 94 * 95 * @return the types specified when the tool was invoked, or an 96 * empty collection if there were none 97 */ 98 Collection<TypeDeclaration> getSpecifiedTypeDeclarations(); 99 100 /** 101 * Returns the declaration of a package given its fully qualified name. 102 * 103 * @param name fully qualified package name, or "" for the unnamed package 104 * @return the declaration of the named package, or null if it cannot 105 * be found 106 */ 107 PackageDeclaration getPackage(String name); 108 109 /** 110 * Returns the declaration of a type given its fully qualified name. | 31 32 import com.sun.mirror.declaration.*; 33 import com.sun.mirror.util.*; 34 35 36 /** 37 * The environment encapsulating the state needed by an annotation processor. 38 * An annotation processing tool makes this environment available 39 * to all annotation processors. 40 * 41 * <p> When an annotation processing tool is invoked, it is given a 42 * set of type declarations on which to operate. These 43 * are refered to as the <i>specified</i> types. 44 * The type declarations said to be <i>included</i> in this invocation 45 * consist of the specified types and any types nested within them. 46 * 47 * <p> {@link DeclarationFilter} 48 * provides a simple way to select just the items of interest 49 * when a method returns a collection of declarations. 50 * 51 * @deprecated All components of this API have been superseded by the 52 * standardized annotation processing API. The replacement for the 53 * functionality of this interface is {@link 54 * javax.annotation.processing.ProcessingEnvironment}. 55 * 56 * @author Joseph D. Darcy 57 * @author Scott Seligman 58 * @since 1.5 59 */ 60 @Deprecated 61 @SuppressWarnings("deprecation") 62 public interface AnnotationProcessorEnvironment { 63 64 /** 65 * Returns the options passed to the annotation processing tool. 66 * Options are returned in the form of a map from option name 67 * (such as <tt>"-encoding"</tt>) to option value. 68 * For an option with no value (such as <tt>"-help"</tt>), the 69 * corresponding value in the map is <tt>null</tt>. 70 * 71 * <p> Options beginning with <tt>"-A"</tt> are <i>processor-specific.</i> 72 * Such options are unrecognized by the tool, but intended to be used by 73 * some annotation processor. 74 * 75 * @return the options passed to the tool 76 */ 77 Map<String,String> getOptions(); 78 79 /** 80 * Returns the messager used to report errors, warnings, and other 81 * notices. 82 * 83 * @return the messager 84 */ 85 Messager getMessager(); 86 87 /** 88 * Returns the filer used to create new source, class, or auxiliary 89 * files. 90 * 91 * @return the filer 92 */ 93 Filer getFiler(); 94 95 96 /** 97 * Returns the declarations of the types specified when the 98 * annotation processing tool was invoked. 99 * 100 * @return the types specified when the tool was invoked, or an 101 * empty collection if there were none 102 */ 103 Collection<TypeDeclaration> getSpecifiedTypeDeclarations(); 104 105 /** 106 * Returns the declaration of a package given its fully qualified name. 107 * 108 * @param name fully qualified package name, or "" for the unnamed package 109 * @return the declaration of the named package, or null if it cannot 110 * be found 111 */ 112 PackageDeclaration getPackage(String name); 113 114 /** 115 * Returns the declaration of a type given its fully qualified name. |