Class STCodeGenerator
java.lang.Object
io.protostuff.compiler.STCodeGenerator
- All Implemented Interfaces:
ProtoCompiler
- Direct Known Subclasses:
PluginProtoCompiler, ProtoToGwtOverlayCompiler, ProtoToJavaBeanCompiler, ProtoToJavaBeanMeCompiler, ProtoToJavaBeanModelCompiler, ProtoToJavaV2ProtocSchemaCompiler, ProtoToProtoCompiler
Base class for code generators using StringTemplate.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static org.antlr.stringtemplate.StringTemplateGroupLoader(package private) static final ConcurrentHashMap<String, Formatter> (package private) static final ConcurrentHashMap<Class<?>, org.antlr.stringtemplate.AttributeRenderer> static final org.antlr.stringtemplate.StringTemplateErrorListenerstatic intstatic final Patternstatic final org.antlr.stringtemplate.CommonGroupLoaderprotected final Stringstatic final org.antlr.stringtemplate.AttributeRendererstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringchainedFormat(String str, String[] formats) Formats the string n times.protected voidcollect(ProtoModule module, Proto proto, List<Proto> overridden, boolean compile) voidcompile(ProtoModule module) Compiles the proto configured/encapsulated in the module.protected abstract voidcompile(ProtoModule module, Proto proto) protected voidcompile(ProtoModule module, Proto proto, boolean compileImports, boolean recursive) static StringFormats the stringstrusing the formatformatName.The unique id that basically is the target output.static org.antlr.stringtemplate.StringTemplatestatic org.antlr.stringtemplate.StringTemplateGroupprotected static booleanoverride(ProtoModule module, Proto proto) protected static ProtoparseProto(File file, ProtoModule module) protected static voidpostCompile(ProtoModule module, Proto proto) static booleansetAttributeRenderer(Class<?> typeClass, org.antlr.stringtemplate.AttributeRenderer ar) Returns true if there was no previous attribute renderer with the same class.static booleansetFormatter(String name, Formatter f) Returns true if there was no previous formatter with the same name.static voidsetGroupLoader(org.antlr.stringtemplate.StringTemplateGroupLoader loader)
-
Field Details
-
TEMPLATE_BASE
- See Also:
-
FORMAT_DELIM
-
DEFAULT_RENDERERS
static final ConcurrentHashMap<Class<?>, org.antlr.stringtemplate.AttributeRenderer> DEFAULT_RENDERERS -
DEFAULT_FORMATTERS
-
errorCount
public static int errorCount -
ERROR_LISTENER
public static final org.antlr.stringtemplate.StringTemplateErrorListener ERROR_LISTENER -
GROUP_LOADER
public static final org.antlr.stringtemplate.CommonGroupLoader GROUP_LOADER -
STRING_ATTRIBUTE_RENDERER
public static final org.antlr.stringtemplate.AttributeRenderer STRING_ATTRIBUTE_RENDERER -
__loader
private static org.antlr.stringtemplate.StringTemplateGroupLoader __loader -
id
-
-
Constructor Details
-
STCodeGenerator
-
-
Method Details
-
chainedFormat
-
format
-
setAttributeRenderer
public static boolean setAttributeRenderer(Class<?> typeClass, org.antlr.stringtemplate.AttributeRenderer ar) Returns true if there was no previous attribute renderer with the same class. -
setFormatter
-
getSTG
-
getST
-
setGroupLoader
public static void setGroupLoader(org.antlr.stringtemplate.StringTemplateGroupLoader loader) -
getOutputId
Description copied from interface:ProtoCompilerThe unique id that basically is the target output.- Specified by:
getOutputIdin interfaceProtoCompiler
-
compile
Description copied from interface:ProtoCompilerCompiles the proto configured/encapsulated in the module.- Specified by:
compilein interfaceProtoCompiler- Throws:
IOException
-
parseProto
-
compile
protected void compile(ProtoModule module, Proto proto, boolean compileImports, boolean recursive) throws IOException - Throws:
IOException
-
collect
protected void collect(ProtoModule module, Proto proto, List<Proto> overridden, boolean compile) throws IOException - Throws:
IOException
-
override
-
postCompile
-
compile
- Throws:
IOException
-