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")
|
||||
public class TestServiceGrpc {
|
||||
|
||||
public static final String SERVICE_NAME = "grpc.testing.TestService";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi
|
||||
public static final io.grpc.MethodDescriptor<io.grpc.testing.SimpleRequest,
|
||||
|
|
@ -153,7 +155,7 @@ public class TestServiceGrpc {
|
|||
|
||||
public static io.grpc.ServerServiceDefinition bindService(
|
||||
final TestService serviceImpl) {
|
||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
|
||||
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||
METHOD_UNARY_CALL,
|
||||
asyncUnaryCall(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
|||
@javax.annotation.Generated("by gRPC proto compiler")
|
||||
public class WorkerGrpc {
|
||||
|
||||
public static final String SERVICE_NAME = "grpc.testing.Worker";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi
|
||||
public static final io.grpc.MethodDescriptor<io.grpc.testing.ClientArgs,
|
||||
|
|
@ -135,7 +137,7 @@ public class WorkerGrpc {
|
|||
|
||||
public static io.grpc.ServerServiceDefinition bindService(
|
||||
final Worker serviceImpl) {
|
||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.Worker")
|
||||
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||
METHOD_RUN_TEST,
|
||||
asyncBidiStreamingCall(
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ static void PrintBindServiceMethod(const ServiceDescriptor* service,
|
|||
p->Indent();
|
||||
p->Print(*vars,
|
||||
"return "
|
||||
"$ServerServiceDefinition$.builder(\"$Package$$service_name$\")\n");
|
||||
"$ServerServiceDefinition$.builder(SERVICE_NAME)\n");
|
||||
p->Indent();
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
const MethodDescriptor* method = service->method(i);
|
||||
|
|
@ -514,6 +514,11 @@ static void PrintService(const ServiceDescriptor* service,
|
|||
"public class $service_class_name$ {\n\n");
|
||||
p->Indent();
|
||||
|
||||
p->Print(
|
||||
*vars,
|
||||
"public static final String SERVICE_NAME = "
|
||||
"\"$Package$$service_name$\";\n\n");
|
||||
|
||||
PrintMethodFields(service, vars, p, generate_nano);
|
||||
|
||||
p->Print(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
|||
@javax.annotation.Generated("by gRPC proto compiler")
|
||||
public class TestServiceGrpc {
|
||||
|
||||
public static final String SERVICE_NAME = "grpc.testing.TestService";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi
|
||||
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(
|
||||
final TestService serviceImpl) {
|
||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
|
||||
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||
METHOD_UNARY_CALL,
|
||||
asyncUnaryCall(
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ import java.io.IOException;
|
|||
@javax.annotation.Generated("by gRPC proto compiler")
|
||||
public class TestServiceGrpc {
|
||||
|
||||
public static final String SERVICE_NAME = "grpc.testing.TestService";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi
|
||||
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(
|
||||
final TestService serviceImpl) {
|
||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
|
||||
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||
METHOD_UNARY_CALL,
|
||||
asyncUnaryCall(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
|||
@javax.annotation.Generated("by gRPC proto compiler")
|
||||
public class GreeterGrpc {
|
||||
|
||||
public static final String SERVICE_NAME = "helloworld.Greeter";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi
|
||||
public static final io.grpc.MethodDescriptor<io.grpc.examples.helloworld.HelloRequest,
|
||||
|
|
@ -134,7 +136,7 @@ public class GreeterGrpc {
|
|||
|
||||
public static io.grpc.ServerServiceDefinition bindService(
|
||||
final Greeter serviceImpl) {
|
||||
return io.grpc.ServerServiceDefinition.builder("helloworld.Greeter")
|
||||
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||
METHOD_SAY_HELLO,
|
||||
asyncUnaryCall(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
|||
@javax.annotation.Generated("by gRPC proto compiler")
|
||||
public class RouteGuideGrpc {
|
||||
|
||||
public static final String SERVICE_NAME = "routeguide.RouteGuide";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi
|
||||
public static final io.grpc.MethodDescriptor<io.grpc.examples.routeguide.Point,
|
||||
|
|
@ -201,7 +203,7 @@ public class RouteGuideGrpc {
|
|||
|
||||
public static io.grpc.ServerServiceDefinition bindService(
|
||||
final RouteGuide serviceImpl) {
|
||||
return io.grpc.ServerServiceDefinition.builder("routeguide.RouteGuide")
|
||||
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||
METHOD_GET_FEATURE,
|
||||
asyncUnaryCall(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
|||
@javax.annotation.Generated("by gRPC proto compiler")
|
||||
public class ReconnectServiceGrpc {
|
||||
|
||||
public static final String SERVICE_NAME = "grpc.testing.ReconnectService";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi
|
||||
public static final io.grpc.MethodDescriptor<com.google.protobuf.EmptyProtos.Empty,
|
||||
|
|
@ -171,7 +173,7 @@ public class ReconnectServiceGrpc {
|
|||
|
||||
public static io.grpc.ServerServiceDefinition bindService(
|
||||
final ReconnectService serviceImpl) {
|
||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.ReconnectService")
|
||||
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||
METHOD_START,
|
||||
asyncUnaryCall(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
|||
@javax.annotation.Generated("by gRPC proto compiler")
|
||||
public class TestServiceGrpc {
|
||||
|
||||
public static final String SERVICE_NAME = "grpc.testing.TestService";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi
|
||||
public static final io.grpc.MethodDescriptor<com.google.protobuf.EmptyProtos.Empty,
|
||||
|
|
@ -257,7 +259,7 @@ public class TestServiceGrpc {
|
|||
|
||||
public static io.grpc.ServerServiceDefinition bindService(
|
||||
final TestService serviceImpl) {
|
||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
|
||||
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||
METHOD_EMPTY_CALL,
|
||||
asyncUnaryCall(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
|
|||
@javax.annotation.Generated("by gRPC proto compiler")
|
||||
public class UnimplementedServiceGrpc {
|
||||
|
||||
public static final String SERVICE_NAME = "grpc.testing.UnimplementedService";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
@io.grpc.ExperimentalApi
|
||||
public static final io.grpc.MethodDescriptor<com.google.protobuf.EmptyProtos.Empty,
|
||||
|
|
@ -134,7 +136,7 @@ public class UnimplementedServiceGrpc {
|
|||
|
||||
public static io.grpc.ServerServiceDefinition bindService(
|
||||
final UnimplementedService serviceImpl) {
|
||||
return io.grpc.ServerServiceDefinition.builder("grpc.testing.UnimplementedService")
|
||||
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
|
||||
.addMethod(io.grpc.ServerMethodDefinition.create(
|
||||
METHOD_UNIMPLEMENTED_CALL,
|
||||
asyncUnaryCall(
|
||||
|
|
|
|||
Loading…
Reference in New Issue