Top Inners Fields Constructors Methods
io.vertx.codegen

public Class CodeGenProcessor

extends AbstractProcessor
Class Inheritance
Annotations
@SupportedOptions:codegen.output, codegen.generators
@SupportedSourceVersion:RELEASE_8
Imports
io.vertx.codegen.annotations.DataObject, .VertxGen, io.vertx.codegen.generators.dataobjecthelper.DataObjectHelperGenLoader, javax.annotation.processing.AbstractProcessor, .Filer, .FilerException, .ProcessingEnvironment, .RoundEnvironment, javax.lang.model.element.Element, .ElementKind, .TypeElement, javax.tools.Diagnostic, .FileObject, .JavaFileObject, .StandardLocation, java.io.File, .FileWriter, .IOException, .InputStream, .Writer, java.lang.annotation.Annotation, java.net.URL, java.nio.file.Path, java.util.*, java.util.function.Predicate, java.util.logging.Level, .Logger, java.util.regex.Pattern, java.util.stream.Collectors, .Stream, .StreamSupport

Author
Julien Viet

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private List<? extends Generator<?>>
private Map<String, CodeGenProcessor.GeneratedFile>
private Map<String, CodeGenProcessor.GeneratedFile>
private static final int
private static final String
public static final Logger
private List<CodeGen.Converter>
private static final int
private File
private Map<String, String>
private static final int
private Set<Class<? extends Annotation>>
Inherited from javax.annotation.processing.AbstractProcessor:
processingEnv

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private Path
determineSourcePathInEclipse()

This is clearly a hack and javac will complain (warning: Unclosed files for the types '[PathForCodeGenProcessor]'; these types will not undergo annotation processing) and possibly fail the build when the -Werror compiler option is set.

private Predicate<Generator<M extends Model>>
private Collection<? extends Generator<?>>
public Set<String>
public synchronized void
init(ProcessingEnvironment
environment to access facilities the tool framework provides to the processor
processingEnv
)

Overrides javax.annotation.processing.AbstractProcessor.init.

Implements javax.annotation.processing.Processor.init.

Initializes the processor with the processing environment.

private static void
private List<CodeGen.Converter>
public boolean
process(Set<? extends TypeElement>
the annotation interfaces requested to be processed
annotations
,
RoundEnvironment
environment for information about the current and prior round
roundEnv
)

Implements abstract javax.annotation.processing.AbstractProcessor.process.

Implements javax.annotation.processing.Processor.process.

Processes a set of annotation interfaces on root elements originating from the prior round and returns whether or not these annotation interfaces are claimed by this processor.

private void
private void
Inherited from javax.annotation.processing.AbstractProcessor:
getCompletionsgetSupportedOptionsgetSupportedSourceVersionisInitialized

Field Detail

codeGeneratorsback to summary
private List<? extends Generator<?>> codeGenerators
generatedFilesback to summary
private Map<String, CodeGenProcessor.GeneratedFile> generatedFiles
generatedResourcesback to summary
private Map<String, CodeGenProcessor.GeneratedFile> generatedResources
JAVAback to summary
private static final int JAVA
JSON_MAPPERS_PROPERTIES_PATHback to summary
private static final String JSON_MAPPERS_PROPERTIES_PATH
logback to summary
public static final Logger log
mappersback to summary
private List<CodeGen.Converter> mappers
OTHERback to summary
private static final int OTHER
outputDirectoryback to summary
private File outputDirectory
relocationsback to summary
private Map<String, String> relocations
RESOURCEback to summary
private static final int RESOURCE
supportedAnnotationback to summary
private Set<Class<? extends Annotation>> supportedAnnotation

Constructor Detail

CodeGenProcessorback to summary
public CodeGenProcessor()

Method Detail

determineSourcePathInEclipseback to summary
private Path determineSourcePathInEclipse()

This is clearly a hack and javac will complain (warning: Unclosed files for the types '[PathForCodeGenProcessor]'; these types will not undergo annotation processing) and possibly fail the build when the -Werror compiler option is set.

filterGeneratorsback to summary
private Predicate<Generator<M extends Model>> filterGenerators()
getCodeGeneratorsback to summary
private Collection<? extends Generator<?>> getCodeGenerators()
getSupportedAnnotationTypesback to summary
public Set<String> getSupportedAnnotationTypes()

Overrides javax.annotation.processing.AbstractProcessor.getSupportedAnnotationTypes.

Implements javax.annotation.processing.Processor.getSupportedAnnotationTypes.

Doc from javax.annotation.processing.AbstractProcessor.getSupportedAnnotationTypes.

Returns the names of the annotation interfaces supported by this processor.

Returns:Set<String>

the names of the annotation interfaces supported by this processor or an empty set if none

Annotations
@Override
initback to summary
public synchronized void init(ProcessingEnvironment processingEnv)

Overrides javax.annotation.processing.AbstractProcessor.init.

Implements javax.annotation.processing.Processor.init.

Doc from javax.annotation.processing.AbstractProcessor.init.

Initializes the processor with the processing environment.

Parameters
processingEnv:ProcessingEnvironment

environment to access facilities the tool framework provides to the processor

Annotations
@Override
loadJsonMappersback to summary
private static void loadJsonMappers(List<CodeGen.Converter> list, InputStream is) throws IOException
loadJsonMappersback to summary
private List<CodeGen.Converter> loadJsonMappers()
processback to summary
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)

Implements abstract javax.annotation.processing.AbstractProcessor.process.

Implements javax.annotation.processing.Processor.process.

Doc from javax.annotation.processing.AbstractProcessor.process.

Processes a set of annotation interfaces on root elements originating from the prior round and returns whether or not these annotation interfaces are claimed by this processor. If true is returned, the annotation interfaces are claimed and subsequent processors will not be asked to process them; if false is returned, the annotation interfaces are unclaimed and subsequent processors may be asked to process them. A processor may always return the same boolean value or may vary the result based on its own chosen criteria.

The input set will be empty if the processor supports "*" and the root elements have no annotations. A Processor must gracefully handle an empty set of annotations.

Parameters
annotations:Set<? extends TypeElement>

the annotation interfaces requested to be processed

roundEnv:RoundEnvironment

environment for information about the current and prior round

Returns:boolean

Doc from javax.annotation.processing.Processor.process.

whether or not the set of annotation interfaces are claimed by this processor

Annotations
@Override
reportExceptionback to summary
private void reportException(Exception e, Element elt)
reportGenExceptionback to summary
private void reportGenException(GenException e)
io.vertx.codegen back to summary

private Class CodeGenProcessor.GeneratedFile

extends ArrayList<CodeGenProcessor.ModelProcessing>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Map<String, Object>
private final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
add(CodeGenProcessor.ModelProcessing
element to be appended to this list
modelProcessing
)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Appends the specified element to the end of this list.

pack-priv String
Inherited from java.util.ArrayList:
addaddAlladdAlladdFirstaddLastclearclonecontainsensureCapacityequalsforEachgetgetFirstgetLasthashCodeindexOfisEmptyiteratorlastIndexOflistIteratorlistIteratorremoveremoveremoveAllremoveFirstremoveIfremoveLastremoveRangereplaceAllretainAllsetsizesortspliteratorsubListtoArraytoArraytrimToSize

Field Detail

sessionback to summary
private final Map<String, Object> session
uriback to summary
private final String uri

Constructor Detail

GeneratedFileback to summary
public GeneratedFile(String uri)

Method Detail

addback to summary
public boolean add(CodeGenProcessor.ModelProcessing modelProcessing)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Doc from java.util.ArrayList.add.

Appends the specified element to the end of this list.

Parameters
modelProcessing:CodeGenProcessor.ModelProcessing

element to be appended to this list

Returns:boolean

true (as specified by Collection#add)

Annotations
@Override
generateback to summary
pack-priv String generate()
io.vertx.codegen back to summary

private Class CodeGenProcessor.ModelProcessing

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Generator<M extends Model>
pack-priv final Model

Constructor Summary

AccessConstructor and Description
public
ModelProcessing(Model model, Generator<M extends Model> generator)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

generatorback to summary
pack-priv final Generator<M extends Model> generator
modelback to summary
pack-priv final Model model

Constructor Detail

ModelProcessingback to summary
public ModelProcessing(Model model, Generator<M extends Model> generator)