Package io.protostuff.compiler
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 interface
Resolve the stg from the module. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static PluginProtoCompiler.GroupResolver
protected static final boolean
To enable, specify -Dppc.check_filename_placeholder=truefinal org.antlr.stringtemplate.StringTemplate
final String
final org.antlr.stringtemplate.StringTemplateGroup
static final PluginProtoCompiler.GroupResolver
final boolean
final org.antlr.stringtemplate.StringTemplate
final ProtoModule
final String
final String
final String
final org.antlr.stringtemplate.StringTemplate
final org.antlr.stringtemplate.StringTemplate
Fields inherited from class io.protostuff.compiler.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 TypeMethodDescriptionvoid
compile
(ProtoModule module, Proto proto) static void
compileEnumBlock
(ProtoModule module, EnumGroup eg, String packageName, String fileName, org.antlr.stringtemplate.StringTemplate enumBlockTemplate) static void
compileEnumBlockTo
(Writer writer, ProtoModule module, EnumGroup eg, org.antlr.stringtemplate.StringTemplate enumBlockTemplate) static void
compileMessageBlock
(ProtoModule module, Message message, String packageName, String fileName, org.antlr.stringtemplate.StringTemplate messageBlockTemplate) static void
compileMessageBlockTo
(Writer writer, ProtoModule module, Message message, org.antlr.stringtemplate.StringTemplate messageBlockTemplate) void
compileProtoBlock
(ProtoModule module, Proto proto, String packageName, org.antlr.stringtemplate.StringTemplate protoBlockTemplate) private void
compileServiceBlock
(ProtoModule module, Service service, String packageName, String fileName, org.antlr.stringtemplate.StringTemplate serviceBlockTemplate) static void
compileServiceBlockTo
(Writer writer, ProtoModule module, Service service, org.antlr.stringtemplate.StringTemplate serviceBlockTemplate) static String
getFileExtension
(String resource) Get the file extension of the provided stg resource.(package private) static String
getOutputName
(String resource) Returns "foo" from "path/to/foo.java.stg"static org.antlr.stringtemplate.StringTemplate
getTemplateFrom
(org.antlr.stringtemplate.StringTemplateGroup group, String template) Returns null if template is not found.resolveFileName
(String name) static org.antlr.stringtemplate.StringTemplateGroup
resolveSTG
(String stgLocation) Finds the stg resource.static void
Methods inherited from class io.protostuff.compiler.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
Returns "foo" from "path/to/foo.java.stg" -
getFileExtension
Get the file extension of the provided stg resource. -
resolveSTG
Finds the stg resource. -
resolveFileName
-
compile
- Specified by:
compile
in 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
-