public abstract class Generator extends Object
ProtocPlugin.| Constructor and Description |
|---|
Generator() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
applyTemplate(String resourcePath,
Object generatorContext)
Executes a mustache template against a generatorContext object to generate an output string.
|
Stream<com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File> |
generate(com.google.protobuf.compiler.PluginProtos.CodeGeneratorRequest request)
Deprecated.
use
generateFiles(PluginProtos.CodeGeneratorRequest) and return a List instead of a Stream. |
List<com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File> |
generateFiles(com.google.protobuf.compiler.PluginProtos.CodeGeneratorRequest request)
Processes a generator request into a set of files to output.
|
protected com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File |
makeFile(String fileName,
byte[] fileContent)
Creates a protobuf file message from a given name and content.
|
protected com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File |
makeFile(String fileName,
String fileContent)
Creates a protobuf file message from a given name and content.
|
protected List<com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.Feature> |
supportedFeatures()
Signals to protoc which additional generator features this Generator supports.
|
@Deprecated public Stream<com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File> generate(com.google.protobuf.compiler.PluginProtos.CodeGeneratorRequest request) throws GeneratorException
generateFiles(PluginProtos.CodeGeneratorRequest) and return a List instead of a Stream.request - The raw generator request from protoc.GeneratorExceptionpublic List<com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File> generateFiles(com.google.protobuf.compiler.PluginProtos.CodeGeneratorRequest request) throws GeneratorException
request - The raw generator request from protoc.GeneratorExceptionprotected List<com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.Feature> supportedFeatures()
protected String applyTemplate(@Nonnull String resourcePath, @Nonnull Object generatorContext)
resourcePath - Embedded resource template to use.generatorContext - Context object to bind the template to.protected com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File makeFile(String fileName, String fileContent)
fileName - The name of the file to generate.fileContent - The content of the generated file.protected com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File makeFile(String fileName, byte[] fileContent)
fileName - The name of the file to generate.fileContent - The content of the generated file.Copyright © 2023. All rights reserved.