public interface ProcessingEnvironment
Third parties may wish to provide value-add wrappers around the facility objects from this interface, for example a Filer
extension that allows multiple processors to coordinate writing out a single source file. To enable this, for processors running in a context where their side effects via the API could be visible to each other, the tool infrastructure must provide corresponding facility objects that are .equals
, Filer
s that are .equals
, and so on. In addition, the tool invocation must be able to be configured such that from the perspective of the running annotation processors, at least the chosen subset of helper classes are viewed as being loaded by the same class loader. (Since the facility objects manage shared state, the implementation of a wrapper class must know whether or not the same base facility object has been wrapped before.)
Modifier and Type | Method | Description |
---|---|---|
Elements |
getElementUtils() |
Returns an implementation of some utility methods for operating on elements. |
Filer |
getFiler() |
Returns the filer used to create new source, class, or auxiliary files. |
Locale |
getLocale() |
Returns the current locale or null if no locale is in effect. |
Messager |
getMessager() |
Returns the messager used to report errors, warnings, and other notices. |
Map |
getOptions() |
Returns the processor-specific options passed to the annotation processing tool. |
SourceVersion |
getSourceVersion() |
|
Types |
getTypeUtils() |
Returns an implementation of some utility methods for operating on types. |
default boolean |
isPreviewEnabled() |
Returns true if preview features are enabled and false otherwise. |
Map<String,String> getOptions()
null
. See documentation of the particular tool infrastructure being used for details on how to pass in processor-specific options. For example, a command-line implementation may distinguish processor-specific options by prefixing them with a known string like "-A"
; other tool implementations may follow different conventions or provide alternative mechanisms. A given implementation may also provide implementation-specific ways of finding options passed to the tool in addition to the processor-specific options.
Messager getMessager()
Filer getFiler()
Elements getElementUtils()
Types getTypeUtils()
SourceVersion getSourceVersion()
Locale getLocale()
null
if no locale is in effect. The locale can be used to provide localized messages.null
if no locale is in effectdefault boolean isPreviewEnabled()
true
if preview features are enabled and false
otherwise.false
.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.compiler/javax/annotation/processing/ProcessingEnvironment.html