@SupportedAnnotationTypes(value="jdk.internal.jvmci.options.Option") public class OptionProcessor extends AbstractProcessor
Option
. An Options
service is generated
for each top level class containing at least one such field. The name of the generated class for
top level class com.foo.Bar
is com.foo.Bar_Options
.
The build system is expected to create the appropriate entries in META-INF/services/
such
that these service objects can be retrieved as follows:
ServiceLoader<Options> sl = ServiceLoader.load(Options.class); for (Options opts : sl) { for (OptionDescriptor desc : sl) { // use desc } }
Modifier and Type | Class and Description |
---|---|
(package private) static class |
OptionProcessor.OptionInfo |
(package private) static class |
OptionProcessor.OptionsInfo |
Modifier and Type | Field and Description |
---|---|
private Set<Element> |
processed |
processingEnv
Constructor and Description |
---|
OptionProcessor() |
Modifier and Type | Method and Description |
---|---|
private String |
className(TypeMirror t) |
private void |
createFiles(OptionProcessor.OptionsInfo info) |
private void |
createOptionsFile(OptionProcessor.OptionsInfo info,
String pkg,
String relativeName,
Element... originatingElements) |
protected PrintWriter |
createSourceFile(String pkg,
String relativeName,
Filer filer,
Element... originatingElements) |
SourceVersion |
getSupportedSourceVersion() |
private char |
optionTypeToChar(OptionProcessor.OptionInfo option) |
boolean |
process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) |
private void |
processElement(Element element,
OptionProcessor.OptionsInfo info) |
private static Element |
topDeclaringType(Element element) |
getCompletions, getSupportedAnnotationTypes, getSupportedOptions, init, isInitialized
public OptionProcessor()
public SourceVersion getSupportedSourceVersion()
getSupportedSourceVersion
in interface Processor
getSupportedSourceVersion
in class AbstractProcessor
private void processElement(Element element, OptionProcessor.OptionsInfo info)
private void createFiles(OptionProcessor.OptionsInfo info)
private void createOptionsFile(OptionProcessor.OptionsInfo info, String pkg, String relativeName, Element... originatingElements) throws IOException
IOException
private String className(TypeMirror t)
private char optionTypeToChar(OptionProcessor.OptionInfo option)
protected PrintWriter createSourceFile(String pkg, String relativeName, Filer filer, Element... originatingElements)
private static Element topDeclaringType(Element element)
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
process
in interface Processor
process
in class AbstractProcessor