Class InvernoGrpcProtocPlugin
A protoc
plugin used to generate Inverno specific gRPC client and/or server classes.
The command accepts two options:
--client
: tells the plugin to generate client classes--server
: tells the plugin to generate server classes
If none of the above is specified, the plugin generates no classes.
The command parses the code generator request from the standard input by default (i.e. System.in
) as expected when invoked inside protoc.exe
as follows:
$ protoc.exe --plugin=protoc-gen-grpc=invernoGrpcProtocPlugin.sh --grpc_out=target/generated-sources/protobuf/java file.proto
In above command line invernoGrpcProtocPlugin.sh
is an executable script invoking the plugin with the right arguments. For instance:
#!/bin/sh
java -jar inverno-grpc-protoc-plugin.jar --server --client "@$"
It also possible to specify the path to a dump on the command line and execute the command in standalone:
$ java -jar inverno-grpc-protoc-plugin.jar --server --client path/to/dump
The class also exposes several methods to create InvernoGrpcGenerator
instances for generating client and/or server from raw descriptors.
- Since:
- 1.9
- Author:
- Jeremy Kuhn
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic InvernoGrpcGenerator
Creates generator that generates client classes only.static InvernoGrpcGenerator
Creates generator that generates both client and server classes.static void
Executes the protoc plugin.static InvernoGrpcGenerator
Creates generator that generates server classes only.
-
Constructor Details
-
InvernoGrpcProtocPlugin
public InvernoGrpcProtocPlugin()
-
-
Method Details
-
main
Executes the protoc plugin.
- Parameters:
args
- the command line arguments
-
generator
Creates generator that generates both client and server classes.
- Returns:
- a generator that generates both client and server
-
clientGenerator
Creates generator that generates client classes only.
- Returns:
- a generator that generates client
-
serverGenerator
Creates generator that generates server classes only.
- Returns:
- a generator that generates server
-