mirror of https://github.com/grpc/grpc-java.git
Extract the fully-qualified service name into a public static final field on the service container type.
This commit is contained in:
parent
01ba973dd4
commit
66b984ca9d
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
||||||
@javax.annotation.Generated("by gRPC proto compiler")
|
@javax.annotation.Generated("by gRPC proto compiler")
|
||||||
public class TestServiceGrpc {
|
public class TestServiceGrpc {
|
||||||
|
|
||||||
|
public static final String SERVICE_NAME = "grpc.testing.TestService";
|
||||||
|
|
||||||
// Static method descriptors that strictly reflect the proto.
|
// Static method descriptors that strictly reflect the proto.
|
||||||
@io.grpc.ExperimentalApi
|
@io.grpc.ExperimentalApi
|
||||||
public static final io.grpc.MethodDescriptor<io.grpc.testing.SimpleRequest,
|
public static final io.grpc.MethodDescriptor<io.grpc.testing.SimpleRequest,
|
||||||
|
|
@ -153,7 +155,7 @@ public class TestServiceGrpc {
|
||||||
|
|
||||||
public static io.grpc.ServerServiceDefinition bindService(
|
public static io.grpc.ServerServiceDefinition bindService(
|
||||||
final TestService serviceImpl) {
|
final TestService serviceImpl) {
|
||||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
|
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||||
METHOD_UNARY_CALL,
|
METHOD_UNARY_CALL,
|
||||||
asyncUnaryCall(
|
asyncUnaryCall(
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
||||||
@javax.annotation.Generated("by gRPC proto compiler")
|
@javax.annotation.Generated("by gRPC proto compiler")
|
||||||
public class WorkerGrpc {
|
public class WorkerGrpc {
|
||||||
|
|
||||||
|
public static final String SERVICE_NAME = "grpc.testing.Worker";
|
||||||
|
|
||||||
// Static method descriptors that strictly reflect the proto.
|
// Static method descriptors that strictly reflect the proto.
|
||||||
@io.grpc.ExperimentalApi
|
@io.grpc.ExperimentalApi
|
||||||
public static final io.grpc.MethodDescriptor<io.grpc.testing.ClientArgs,
|
public static final io.grpc.MethodDescriptor<io.grpc.testing.ClientArgs,
|
||||||
|
|
@ -135,7 +137,7 @@ public class WorkerGrpc {
|
||||||
|
|
||||||
public static io.grpc.ServerServiceDefinition bindService(
|
public static io.grpc.ServerServiceDefinition bindService(
|
||||||
final Worker serviceImpl) {
|
final Worker serviceImpl) {
|
||||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.Worker")
|
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||||
METHOD_RUN_TEST,
|
METHOD_RUN_TEST,
|
||||||
asyncBidiStreamingCall(
|
asyncBidiStreamingCall(
|
||||||
|
|
|
||||||
|
|
@ -421,7 +421,7 @@ static void PrintBindServiceMethod(const ServiceDescriptor* service,
|
||||||
p->Indent();
|
p->Indent();
|
||||||
p->Print(*vars,
|
p->Print(*vars,
|
||||||
"return "
|
"return "
|
||||||
"$ServerServiceDefinition$.builder(\"$Package$$service_name$\")\n");
|
"$ServerServiceDefinition$.builder(SERVICE_NAME)\n");
|
||||||
p->Indent();
|
p->Indent();
|
||||||
for (int i = 0; i < service->method_count(); ++i) {
|
for (int i = 0; i < service->method_count(); ++i) {
|
||||||
const MethodDescriptor* method = service->method(i);
|
const MethodDescriptor* method = service->method(i);
|
||||||
|
|
@ -514,6 +514,11 @@ static void PrintService(const ServiceDescriptor* service,
|
||||||
"public class $service_class_name$ {\n\n");
|
"public class $service_class_name$ {\n\n");
|
||||||
p->Indent();
|
p->Indent();
|
||||||
|
|
||||||
|
p->Print(
|
||||||
|
*vars,
|
||||||
|
"public static final String SERVICE_NAME = "
|
||||||
|
"\"$Package$$service_name$\";\n\n");
|
||||||
|
|
||||||
PrintMethodFields(service, vars, p, generate_nano);
|
PrintMethodFields(service, vars, p, generate_nano);
|
||||||
|
|
||||||
p->Print(
|
p->Print(
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
||||||
@javax.annotation.Generated("by gRPC proto compiler")
|
@javax.annotation.Generated("by gRPC proto compiler")
|
||||||
public class TestServiceGrpc {
|
public class TestServiceGrpc {
|
||||||
|
|
||||||
|
public static final String SERVICE_NAME = "grpc.testing.TestService";
|
||||||
|
|
||||||
// Static method descriptors that strictly reflect the proto.
|
// Static method descriptors that strictly reflect the proto.
|
||||||
@io.grpc.ExperimentalApi
|
@io.grpc.ExperimentalApi
|
||||||
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
|
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
|
||||||
|
|
@ -220,7 +222,7 @@ public class TestServiceGrpc {
|
||||||
|
|
||||||
public static io.grpc.ServerServiceDefinition bindService(
|
public static io.grpc.ServerServiceDefinition bindService(
|
||||||
final TestService serviceImpl) {
|
final TestService serviceImpl) {
|
||||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
|
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||||
METHOD_UNARY_CALL,
|
METHOD_UNARY_CALL,
|
||||||
asyncUnaryCall(
|
asyncUnaryCall(
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ import java.io.IOException;
|
||||||
@javax.annotation.Generated("by gRPC proto compiler")
|
@javax.annotation.Generated("by gRPC proto compiler")
|
||||||
public class TestServiceGrpc {
|
public class TestServiceGrpc {
|
||||||
|
|
||||||
|
public static final String SERVICE_NAME = "grpc.testing.TestService";
|
||||||
|
|
||||||
// Static method descriptors that strictly reflect the proto.
|
// Static method descriptors that strictly reflect the proto.
|
||||||
@io.grpc.ExperimentalApi
|
@io.grpc.ExperimentalApi
|
||||||
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest,
|
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest,
|
||||||
|
|
@ -282,7 +284,7 @@ public class TestServiceGrpc {
|
||||||
|
|
||||||
public static io.grpc.ServerServiceDefinition bindService(
|
public static io.grpc.ServerServiceDefinition bindService(
|
||||||
final TestService serviceImpl) {
|
final TestService serviceImpl) {
|
||||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
|
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||||
METHOD_UNARY_CALL,
|
METHOD_UNARY_CALL,
|
||||||
asyncUnaryCall(
|
asyncUnaryCall(
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
||||||
@javax.annotation.Generated("by gRPC proto compiler")
|
@javax.annotation.Generated("by gRPC proto compiler")
|
||||||
public class GreeterGrpc {
|
public class GreeterGrpc {
|
||||||
|
|
||||||
|
public static final String SERVICE_NAME = "helloworld.Greeter";
|
||||||
|
|
||||||
// Static method descriptors that strictly reflect the proto.
|
// Static method descriptors that strictly reflect the proto.
|
||||||
@io.grpc.ExperimentalApi
|
@io.grpc.ExperimentalApi
|
||||||
public static final io.grpc.MethodDescriptor<io.grpc.examples.helloworld.HelloRequest,
|
public static final io.grpc.MethodDescriptor<io.grpc.examples.helloworld.HelloRequest,
|
||||||
|
|
@ -134,7 +136,7 @@ public class GreeterGrpc {
|
||||||
|
|
||||||
public static io.grpc.ServerServiceDefinition bindService(
|
public static io.grpc.ServerServiceDefinition bindService(
|
||||||
final Greeter serviceImpl) {
|
final Greeter serviceImpl) {
|
||||||
return io.grpc.ServerServiceDefinition.builder("helloworld.Greeter")
|
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||||
METHOD_SAY_HELLO,
|
METHOD_SAY_HELLO,
|
||||||
asyncUnaryCall(
|
asyncUnaryCall(
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
||||||
@javax.annotation.Generated("by gRPC proto compiler")
|
@javax.annotation.Generated("by gRPC proto compiler")
|
||||||
public class RouteGuideGrpc {
|
public class RouteGuideGrpc {
|
||||||
|
|
||||||
|
public static final String SERVICE_NAME = "routeguide.RouteGuide";
|
||||||
|
|
||||||
// Static method descriptors that strictly reflect the proto.
|
// Static method descriptors that strictly reflect the proto.
|
||||||
@io.grpc.ExperimentalApi
|
@io.grpc.ExperimentalApi
|
||||||
public static final io.grpc.MethodDescriptor<io.grpc.examples.routeguide.Point,
|
public static final io.grpc.MethodDescriptor<io.grpc.examples.routeguide.Point,
|
||||||
|
|
@ -201,7 +203,7 @@ public class RouteGuideGrpc {
|
||||||
|
|
||||||
public static io.grpc.ServerServiceDefinition bindService(
|
public static io.grpc.ServerServiceDefinition bindService(
|
||||||
final RouteGuide serviceImpl) {
|
final RouteGuide serviceImpl) {
|
||||||
return io.grpc.ServerServiceDefinition.builder("routeguide.RouteGuide")
|
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||||
METHOD_GET_FEATURE,
|
METHOD_GET_FEATURE,
|
||||||
asyncUnaryCall(
|
asyncUnaryCall(
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
||||||
@javax.annotation.Generated("by gRPC proto compiler")
|
@javax.annotation.Generated("by gRPC proto compiler")
|
||||||
public class ReconnectServiceGrpc {
|
public class ReconnectServiceGrpc {
|
||||||
|
|
||||||
|
public static final String SERVICE_NAME = "grpc.testing.ReconnectService";
|
||||||
|
|
||||||
// Static method descriptors that strictly reflect the proto.
|
// Static method descriptors that strictly reflect the proto.
|
||||||
@io.grpc.ExperimentalApi
|
@io.grpc.ExperimentalApi
|
||||||
public static final io.grpc.MethodDescriptor<com.google.protobuf.EmptyProtos.Empty,
|
public static final io.grpc.MethodDescriptor<com.google.protobuf.EmptyProtos.Empty,
|
||||||
|
|
@ -171,7 +173,7 @@ public class ReconnectServiceGrpc {
|
||||||
|
|
||||||
public static io.grpc.ServerServiceDefinition bindService(
|
public static io.grpc.ServerServiceDefinition bindService(
|
||||||
final ReconnectService serviceImpl) {
|
final ReconnectService serviceImpl) {
|
||||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.ReconnectService")
|
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||||
METHOD_START,
|
METHOD_START,
|
||||||
asyncUnaryCall(
|
asyncUnaryCall(
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
||||||
@javax.annotation.Generated("by gRPC proto compiler")
|
@javax.annotation.Generated("by gRPC proto compiler")
|
||||||
public class TestServiceGrpc {
|
public class TestServiceGrpc {
|
||||||
|
|
||||||
|
public static final String SERVICE_NAME = "grpc.testing.TestService";
|
||||||
|
|
||||||
// Static method descriptors that strictly reflect the proto.
|
// Static method descriptors that strictly reflect the proto.
|
||||||
@io.grpc.ExperimentalApi
|
@io.grpc.ExperimentalApi
|
||||||
public static final io.grpc.MethodDescriptor<com.google.protobuf.EmptyProtos.Empty,
|
public static final io.grpc.MethodDescriptor<com.google.protobuf.EmptyProtos.Empty,
|
||||||
|
|
@ -257,7 +259,7 @@ public class TestServiceGrpc {
|
||||||
|
|
||||||
public static io.grpc.ServerServiceDefinition bindService(
|
public static io.grpc.ServerServiceDefinition bindService(
|
||||||
final TestService serviceImpl) {
|
final TestService serviceImpl) {
|
||||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
|
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||||
METHOD_EMPTY_CALL,
|
METHOD_EMPTY_CALL,
|
||||||
asyncUnaryCall(
|
asyncUnaryCall(
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
||||||
@javax.annotation.Generated("by gRPC proto compiler")
|
@javax.annotation.Generated("by gRPC proto compiler")
|
||||||
public class UnimplementedServiceGrpc {
|
public class UnimplementedServiceGrpc {
|
||||||
|
|
||||||
|
public static final String SERVICE_NAME = "grpc.testing.UnimplementedService";
|
||||||
|
|
||||||
// Static method descriptors that strictly reflect the proto.
|
// Static method descriptors that strictly reflect the proto.
|
||||||
@io.grpc.ExperimentalApi
|
@io.grpc.ExperimentalApi
|
||||||
public static final io.grpc.MethodDescriptor<com.google.protobuf.EmptyProtos.Empty,
|
public static final io.grpc.MethodDescriptor<com.google.protobuf.EmptyProtos.Empty,
|
||||||
|
|
@ -134,7 +136,7 @@ public class UnimplementedServiceGrpc {
|
||||||
|
|
||||||
public static io.grpc.ServerServiceDefinition bindService(
|
public static io.grpc.ServerServiceDefinition bindService(
|
||||||
final UnimplementedService serviceImpl) {
|
final UnimplementedService serviceImpl) {
|
||||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.UnimplementedService")
|
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||||
METHOD_UNIMPLEMENTED_CALL,
|
METHOD_UNIMPLEMENTED_CALL,
|
||||||
asyncUnaryCall(
|
asyncUnaryCall(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue