Top Inners Fields Constructors Methods
io.vertx.docgen

public abstract Class BaseProcessor

extends AbstractProcessor
Class Inheritance
Known Direct Subclasses
io.vertx.docgen.DocGenProcessor, io.vertx.docgen.JavaDocGenProcessor
Imports
com.sun.source.doctree.*, .ErroneousTree, .LiteralTree, com.sun.source.util.DocTreeScanner, .DocTrees, .TreePath, com.sun.tools.javac.code.Symbol, javax.annotation.processing.AbstractProcessor, .ProcessingEnvironment, .RoundEnvironment, javax.lang.model.SourceVersion, javax.lang.model.element.*, javax.tools.Diagnostic, .JavaFileObject, java.io.*, java.net.URL, java.nio.charset.StandardCharsets, java.nio.file.Files, java.util.*, java.util.jar.Attributes, .Manifest, java.util.regex.Matcher, .Pattern

Author
Julien Viet

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv abstract class
pack-priv class
BaseProcessor.ElementResolution

The resolution of an element.

pack-priv class
pack-priv class
pack-priv class

Field Summary

Modifier and TypeField and Description
private static final Pattern
protected DocTrees
pack-priv Map<String, String>
protected Helper
protected Set<PostProcessor>
protected Map<String, BaseProcessor.ElementResolution>
protected List<String>
private final LinkedList<PackageElement>
private final Map<BaseProcessor.Doc, Map<DocGenerator, DocWriter>>
Inherited from javax.annotation.processing.AbstractProcessor:
processingEnv

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

the content after post-processing.
applyPostProcessors
(String name2, String
the (asciidoc) content
content
)

Apply post-processors.

public String

Returns:

the content with variable values
applyVariableSubstitution
(String
the content
content
)

Replace `@{var} by the variable value passed to the annotation processor.

private void
protected abstract Iterable<DocGenerator>
protected String

Returns:

the extension obtained from processor option docgen.extension defaults to .adoc when absent.
getExtension
()

public synchronized PostProcessor
public Set<String>
public Set<String>
public SourceVersion
private URL
getURL(JavaFileObject fileObject)

private Map<DocGenerator, DocWriter>
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.

protected String
postProcess(String name, String content)

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.

public synchronized BaseProcessor
private String
render(List<? extends DocTree> trees)

private Coordinate

Returns:

the resolved coordinate object or null if the element is locally compiled
resolveCoordinate
(TypeElement
the type element to resolve
typeElt
)

Resolve the coordinate of the type element, this method returns either:

  • a io.vertx.docgen.Coordinate object, the coordinate object can have null fields
  • null : the current element is being compiled, which likely means create a local link
private String

Returns:

the label
resolveLabel
(DocGenerator generator, Element
the elt to resolve a label for
elt
)

Resolve a label for the specified element, this is used when a link to a program element does not specify an explicit label.

protected String
protected void
write(DocGenerator generator, BaseProcessor.Doc doc, String content)

Inherited from javax.annotation.processing.AbstractProcessor:
getCompletionsisInitialized

Field Detail

ABCback to summary
private static final Pattern ABC
docTreesback to summary
protected DocTrees docTrees
failuresback to summary
pack-priv Map<String, String> failures
helperback to summary
protected Helper helper
postProcessorsback to summary
protected Set<PostProcessor> postProcessors
resolutionsback to summary
protected Map<String, BaseProcessor.ElementResolution> resolutions
sourcesback to summary
protected List<String> sources
stackback to summary
private final LinkedList<PackageElement> stack
stateback to summary
private final Map<BaseProcessor.Doc, Map<DocGenerator, DocWriter>> state

Constructor Detail

BaseProcessorback to summary
public BaseProcessor()

Method Detail

applyPostProcessorsback to summary
protected String applyPostProcessors(String name2, String content)

Apply post-processors.

Parameters
content:String

the (asciidoc) content

Returns:String

the content after post-processing.

applyVariableSubstitutionback to summary
public String applyVariableSubstitution(String content)

Replace `@{var} by the variable value passed to the annotation processor.

Parameters
content:String

the content

Returns:String

the content with variable values

ensureDirback to summary
private void ensureDir(File dir)
generatorsback to summary
protected abstract Iterable<DocGenerator> generators()
getExtensionback to summary
protected String getExtension()
Returns:String

the extension obtained from processor option docgen.extension defaults to .adoc when absent.

getPostProcessorback to summary
public synchronized PostProcessor getPostProcessor(String name)
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
getSupportedOptionsback to summary
public Set<String> getSupportedOptions()

Overrides javax.annotation.processing.AbstractProcessor.getSupportedOptions.

Implements javax.annotation.processing.Processor.getSupportedOptions.

Doc from javax.annotation.processing.AbstractProcessor.getSupportedOptions.

Returns the options recognized by this processor.

Returns:Set<String>

the options recognized by this processor, or an empty set if none

Annotations
@Override
getSupportedSourceVersionback to summary
public SourceVersion getSupportedSourceVersion()

Overrides javax.annotation.processing.AbstractProcessor.getSupportedSourceVersion.

Implements javax.annotation.processing.Processor.getSupportedSourceVersion.

Doc from javax.annotation.processing.AbstractProcessor.getSupportedSourceVersion.

Returns the latest source version supported by this annotation processor.

Returns:SourceVersion

the latest source version supported by this annotation processor

Annotations
@Override
getURLback to summary
private URL getURL(JavaFileObject fileObject)
handleGenback to summary
private Map<DocGenerator, DocWriter> handleGen(BaseProcessor.Doc doc)
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
postProcessback to summary
protected String postProcess(String name, String content)
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
registerPostProcessorback to summary
public synchronized BaseProcessor registerPostProcessor(PostProcessor postProcessor)
renderback to summary
private String render(List<? extends DocTree> trees)
resolveCoordinateback to summary
private Coordinate resolveCoordinate(TypeElement typeElt)

Resolve the coordinate of the type element, this method returns either:

  • a io.vertx.docgen.Coordinate object, the coordinate object can have null fields
  • null : the current element is being compiled, which likely means create a local link
Parameters
typeElt:TypeElement

the type element to resolve

Returns:Coordinate

the resolved coordinate object or null if the element is locally compiled

resolveLabelback to summary
private String resolveLabel(DocGenerator generator, Element elt)

Resolve a label for the specified element, this is used when a link to a program element does not specify an explicit label.

Subclasses can override it to implement a particular behavior for elements.

Parameters
elt:Element

the elt to resolve a label for

Returns:String

the label

resolveLinkToPackageDocback to summary
protected String resolveLinkToPackageDoc(PackageElement elt)
writeback to summary
protected void write(DocGenerator generator, BaseProcessor.Doc doc, String content)
io.vertx.docgen back to summary

pack-priv abstract Class BaseProcessor.Doc

extends Object
Class Inheritance
Known Direct Subclasses
io.vertx.docgen.BaseProcessor.PackageDoc, io.vertx.docgen.BaseProcessor.FileDoc

Constructor Summary

AccessConstructor and Description
pack-priv
Doc()

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract String
id()

protected final void
process(DocGenerator generator, DocWriter writer)

pack-priv abstract String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Docback to summary
pack-priv Doc()

Method Detail

idback to summary
pack-priv abstract String id()
processback to summary
protected final void process(DocGenerator generator, DocWriter writer)
resolveRelativeFileNameback to summary
pack-priv abstract String resolveRelativeFileName(DocGenerator generator)
io.vertx.docgen back to summary

pack-priv Class BaseProcessor.ElementResolution

extends Object
Class Inheritance

The resolution of an element.

Field Summary

Modifier and TypeField and Description
private Element
private List<BaseProcessor.LinkProcessing>
pack-priv final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private void
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

pack-priv boolean
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

eltback to summary
private Element elt
handlersback to summary
private List<BaseProcessor.LinkProcessing> handlers
signatureback to summary
pack-priv final String signature

Constructor Detail

ElementResolutionback to summary
public ElementResolution(String signature)

Method Detail

addback to summary
private void add(BaseProcessor.LinkProcessing fut)
doResolveback to summary
private void doResolve()
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
tryResolveback to summary
pack-priv boolean tryResolve()
io.vertx.docgen back to summary

pack-priv Class BaseProcessor.FileDoc

extends Doc
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final File

Constructor Summary

AccessConstructor and Description
pack-priv
FileDoc(File file)

Method Summary

Modifier and TypeMethod and Description
public String
public String
Inherited from io.vertx.docgen.BaseProcessor.Doc:
process

Field Detail

fileback to summary
pack-priv final File file

Constructor Detail

FileDocback to summary
pack-priv FileDoc(File file)

Method Detail

idback to summary
public String id()

Implements abstract io.vertx.docgen.BaseProcessor.Doc.id.

Annotations
@Override
resolveRelativeFileNameback to summary
public String resolveRelativeFileName(DocGenerator generator)

Implements abstract io.vertx.docgen.BaseProcessor.Doc.resolveRelativeFileName.

Annotations
@Override
io.vertx.docgen back to summary

pack-priv Class BaseProcessor.LinkProcessing

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final DocGenerator
pack-priv final String
private DocWriter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

generatorback to summary
pack-priv final DocGenerator generator
labelback to summary
pack-priv final String label
writerback to summary
private DocWriter writer

Constructor Detail

LinkProcessingback to summary
public LinkProcessing(DocGenerator generator, String label)

Method Detail

handleback to summary
pack-priv void handle(Element elt)
io.vertx.docgen back to summary

pack-priv Class BaseProcessor.PackageDoc

extends Doc
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final PackageElement

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public String
public String

Returns:

the relative file name
resolveRelativeFileName
(DocGenerator
the doc generator
generator
)

Implements abstract io.vertx.docgen.BaseProcessor.Doc.resolveRelativeFileName.

Return the relative file name of a document.

Inherited from io.vertx.docgen.BaseProcessor.Doc:
process

Field Detail

eltback to summary
pack-priv final PackageElement elt

Constructor Detail

PackageDocback to summary
pack-priv PackageDoc(PackageElement elt)

Method Detail

idback to summary
public String id()

Implements abstract io.vertx.docgen.BaseProcessor.Doc.id.

Annotations
@Override
resolveRelativeFileNameback to summary
public String resolveRelativeFileName(DocGenerator generator)

Implements abstract io.vertx.docgen.BaseProcessor.Doc.resolveRelativeFileName.

Return the relative file name of a document.

Parameters
generator:DocGenerator

the doc generator

Returns:String

the relative file name