Interface GeneratorFactory
-
public interface GeneratorFactory
Interface for handling generators in the providence compiler (pvdc). To make a generator module:- Place following dependencies as
provided
scope. - Make a jar file bundle with the
maven-shade-plugin
. - Set the
Providence-Generator-Factory
property in the javaMANIFEST.MF
to point at the implementation of this interface. - See documentation for
pvdc
for where the jar file should be placed to be included in the available generators.
Dependencies
<dependencies> <dependency> <groupId>net.morimekta.providence</groupId> <artifactId>providence-core</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>net.morimekta.providence</groupId> <artifactId>providence-reflect</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>net.morimekta.providence</groupId> <artifactId>providence-generator</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>net.morimekta.utils</groupId> <artifactId>io-util</artifactId> <scope>provided</scope> </dependency> </dependencies>
Manifest Transformer
<transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <manifestEntries> <Providence-Generator-Factory>net.morimekta.providence.generator.format.js.JSGenerator</Providence-Generator-Factory> </manifestEntries> </transformer> </transformers>
- Place following dependencies as
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MANIFEST_PROPERTY
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Generator
createGenerator(FileManager manager, GeneratorOptions generatorOptions, java.util.Collection<java.lang.String> options)
Create the actual generator.java.lang.String
generatorDescription()
A general description of the generator.java.lang.String
generatorName()
The name of the generator.default void
printGeneratorOptionsHelp(java.io.PrintStream out)
Print a listing of the generator options in a CLI like point list.
-
-
-
Field Detail
-
MANIFEST_PROPERTY
static final java.lang.String MANIFEST_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
generatorName
java.lang.String generatorName()
The name of the generator. This is what must be matched in the--gen
generator CLI argument.- Returns:
- The name of the generator.
-
generatorDescription
java.lang.String generatorDescription()
A general description of the generator. Should be in the range of 20-60 characters.- Returns:
- The generator description.
-
printGeneratorOptionsHelp
default void printGeneratorOptionsHelp(java.io.PrintStream out)
Print a listing of the generator options in a CLI like point list. E.g.:- first : The first option, does this. - second : The second option, does that.
- Parameters:
out
- The print stream to write to.
-
createGenerator
Generator createGenerator(FileManager manager, GeneratorOptions generatorOptions, java.util.Collection<java.lang.String> options)
Create the actual generator. The generator instance is usually the same when generating many thrift programs, but does not need to be synchronized.- Parameters:
manager
- The file manager to use for creating files.generatorOptions
- The general generator options.options
- List of string options to create generator-specific options.- Returns:
- The generator instance.
-
-