Class PluginProtoCompiler
java.lang.Object
io.protostuff.compiler.STCodeGenerator
io.protostuff.compiler.PluginProtoCompiler
- All Implemented Interfaces:
ProtoCompiler
A plugin proto compiler whose output relies on the 'output' param configured in
ProtoModule. The output param
should point to a StringTemplate resource (file, url, or from classpath).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceResolve the stg from the module. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static PluginProtoCompiler.GroupResolverprotected static final booleanTo enable, specify -Dppc.check_filename_placeholder=truefinal org.antlr.stringtemplate.StringTemplatefinal Stringfinal org.antlr.stringtemplate.StringTemplateGroupstatic final PluginProtoCompiler.GroupResolverfinal booleanfinal org.antlr.stringtemplate.StringTemplatefinal ProtoModulefinal Stringfinal Stringfinal Stringfinal org.antlr.stringtemplate.StringTemplatefinal org.antlr.stringtemplate.StringTemplateFields inherited from class STCodeGenerator
DEFAULT_FORMATTERS, DEFAULT_RENDERERS, ERROR_LISTENER, errorCount, FORMAT_DELIM, GROUP_LOADER, id, STRING_ATTRIBUTE_RENDERER, TEMPLATE_BASE -
Constructor Summary
ConstructorsConstructorDescriptionPluginProtoCompiler(ProtoModule module, boolean checkFilenamePlaceHolder, org.antlr.stringtemplate.StringTemplateGroup group) PluginProtoCompiler(ProtoModule module, String stgLocation) PluginProtoCompiler(ProtoModule module, String stgLocation, boolean checkFilenamePlaceHolder) -
Method Summary
Modifier and TypeMethodDescriptionvoidcompile(ProtoModule module, Proto proto) static voidcompileEnumBlock(ProtoModule module, EnumGroup eg, String packageName, String fileName, org.antlr.stringtemplate.StringTemplate enumBlockTemplate) static voidcompileEnumBlockTo(Writer writer, ProtoModule module, EnumGroup eg, org.antlr.stringtemplate.StringTemplate enumBlockTemplate) static voidcompileMessageBlock(ProtoModule module, Message message, String packageName, String fileName, org.antlr.stringtemplate.StringTemplate messageBlockTemplate) static voidcompileMessageBlockTo(Writer writer, ProtoModule module, Message message, org.antlr.stringtemplate.StringTemplate messageBlockTemplate) voidcompileProtoBlock(ProtoModule module, Proto proto, String packageName, org.antlr.stringtemplate.StringTemplate protoBlockTemplate) private voidcompileServiceBlock(ProtoModule module, Service service, String packageName, String fileName, org.antlr.stringtemplate.StringTemplate serviceBlockTemplate) static voidcompileServiceBlockTo(Writer writer, ProtoModule module, Service service, org.antlr.stringtemplate.StringTemplate serviceBlockTemplate) static StringgetFileExtension(String resource) Get the file extension of the provided stg resource.(package private) static StringgetOutputName(String resource) Returns "foo" from "path/to/foo.java.stg"static org.antlr.stringtemplate.StringTemplategetTemplateFrom(org.antlr.stringtemplate.StringTemplateGroup group, String template) Returns null if template is not found.resolveFileName(String name) static org.antlr.stringtemplate.StringTemplateGroupresolveSTG(String stgLocation) Finds the stg resource.static voidMethods inherited from class STCodeGenerator
chainedFormat, collect, compile, compile, format, getOutputId, getST, getSTG, override, parseProto, postCompile, setAttributeRenderer, setFormatter, setGroupLoader
-
Field Details
-
CHECK_FILENAME_PLACEHOLDER
protected static final boolean CHECK_FILENAME_PLACEHOLDERTo enable, specify -Dppc.check_filename_placeholder=true -
GROUP_RESOLVER
-
__resolver
-
module
-
group
public final org.antlr.stringtemplate.StringTemplateGroup group -
enumBlockTemplate
public final org.antlr.stringtemplate.StringTemplate enumBlockTemplate -
messageBlockTemplate
public final org.antlr.stringtemplate.StringTemplate messageBlockTemplate -
protoBlockTemplate
public final org.antlr.stringtemplate.StringTemplate protoBlockTemplate -
serviceBlockTemplate
public final org.antlr.stringtemplate.StringTemplate serviceBlockTemplate -
javaOutput
public final boolean javaOutput -
fileExtension
-
outputName
-
outputPrefix
-
outputSuffix
-
-
Constructor Details
-
PluginProtoCompiler
-
PluginProtoCompiler
public PluginProtoCompiler(ProtoModule module, String stgLocation, boolean checkFilenamePlaceHolder) -
PluginProtoCompiler
public PluginProtoCompiler(ProtoModule module, boolean checkFilenamePlaceHolder, org.antlr.stringtemplate.StringTemplateGroup group)
-
-
Method Details
-
setGroupResolver
-
getTemplateFrom
public static org.antlr.stringtemplate.StringTemplate getTemplateFrom(org.antlr.stringtemplate.StringTemplateGroup group, String template) Returns null if template is not found. -
getOutputName
-
getFileExtension
-
resolveSTG
Finds the stg resource. -
resolveFileName
-
compile
- Specified by:
compilein classSTCodeGenerator- Throws:
IOException
-
compileServiceBlock
private void compileServiceBlock(ProtoModule module, Service service, String packageName, String fileName, org.antlr.stringtemplate.StringTemplate serviceBlockTemplate) throws IOException - Throws:
IOException
-
compileServiceBlockTo
public static void compileServiceBlockTo(Writer writer, ProtoModule module, Service service, org.antlr.stringtemplate.StringTemplate serviceBlockTemplate) throws IOException - Throws:
IOException
-
compileEnumBlock
public static void compileEnumBlock(ProtoModule module, EnumGroup eg, String packageName, String fileName, org.antlr.stringtemplate.StringTemplate enumBlockTemplate) throws IOException - Throws:
IOException
-
compileEnumBlockTo
public static void compileEnumBlockTo(Writer writer, ProtoModule module, EnumGroup eg, org.antlr.stringtemplate.StringTemplate enumBlockTemplate) throws IOException - Throws:
IOException
-
compileMessageBlock
public static void compileMessageBlock(ProtoModule module, Message message, String packageName, String fileName, org.antlr.stringtemplate.StringTemplate messageBlockTemplate) throws IOException - Throws:
IOException
-
compileMessageBlockTo
public static void compileMessageBlockTo(Writer writer, ProtoModule module, Message message, org.antlr.stringtemplate.StringTemplate messageBlockTemplate) throws IOException - Throws:
IOException
-
compileProtoBlock
public void compileProtoBlock(ProtoModule module, Proto proto, String packageName, org.antlr.stringtemplate.StringTemplate protoBlockTemplate) throws IOException - Throws:
IOException
-