PadPlusServerGrpc.java

package wechaty.padplus.grpc;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.29.0)",
    comments = "Source: PadPlusServer.proto")
public final class PadPlusServerGrpc {

  private PadPlusServerGrpc() {}

  public static final String SERVICE_NAME = "PadPlusServer.PadPlusServer";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject,
      wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject> getRequestMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "Request",
      requestType = wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject.class,
      responseType = wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor<wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject,
      wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject> getRequestMethod() {
    io.grpc.MethodDescriptor<wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject, wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject> getRequestMethod;
    if ((getRequestMethod = PadPlusServerGrpc.getRequestMethod) == null) {
      synchronized (PadPlusServerGrpc.class) {
        if ((getRequestMethod = PadPlusServerGrpc.getRequestMethod) == null) {
          PadPlusServerGrpc.getRequestMethod = getRequestMethod =
              io.grpc.MethodDescriptor.<wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject, wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Request"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject.getDefaultInstance()))
              .setSchemaDescriptor(new PadPlusServerMethodDescriptorSupplier("Request"))
              .build();
        }
      }
    }
    return getRequestMethod;
  }

  private static volatile io.grpc.MethodDescriptor<wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig,
      wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse> getInitMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "Init",
      requestType = wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig.class,
      responseType = wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse.class,
      methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
  public static io.grpc.MethodDescriptor<wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig,
      wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse> getInitMethod() {
    io.grpc.MethodDescriptor<wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig, wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse> getInitMethod;
    if ((getInitMethod = PadPlusServerGrpc.getInitMethod) == null) {
      synchronized (PadPlusServerGrpc.class) {
        if ((getInitMethod = PadPlusServerGrpc.getInitMethod) == null) {
          PadPlusServerGrpc.getInitMethod = getInitMethod =
              io.grpc.MethodDescriptor.<wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig, wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Init"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse.getDefaultInstance()))
              .setSchemaDescriptor(new PadPlusServerMethodDescriptorSupplier("Init"))
              .build();
        }
      }
    }
    return getInitMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static PadPlusServerStub newStub(io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<PadPlusServerStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<PadPlusServerStub>() {
        @java.lang.Override
        public PadPlusServerStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new PadPlusServerStub(channel, callOptions);
        }
      };
    return PadPlusServerStub.newStub(factory, channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static PadPlusServerBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<PadPlusServerBlockingStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<PadPlusServerBlockingStub>() {
        @java.lang.Override
        public PadPlusServerBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new PadPlusServerBlockingStub(channel, callOptions);
        }
      };
    return PadPlusServerBlockingStub.newStub(factory, channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static PadPlusServerFutureStub newFutureStub(
      io.grpc.Channel channel) {
    io.grpc.stub.AbstractStub.StubFactory<PadPlusServerFutureStub> factory =
      new io.grpc.stub.AbstractStub.StubFactory<PadPlusServerFutureStub>() {
        @java.lang.Override
        public PadPlusServerFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
          return new PadPlusServerFutureStub(channel, callOptions);
        }
      };
    return PadPlusServerFutureStub.newStub(factory, channel);
  }

  /**
   */
  public static abstract class PadPlusServerImplBase implements io.grpc.BindableService {

    /**
     */
    public void request(wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject request,
        io.grpc.stub.StreamObserver<wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject> responseObserver) {
      asyncUnimplementedUnaryCall(getRequestMethod(), responseObserver);
    }

    /**
     */
    public void init(wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig request,
        io.grpc.stub.StreamObserver<wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse> responseObserver) {
      asyncUnimplementedUnaryCall(getInitMethod(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getRequestMethod(),
            asyncUnaryCall(
              new MethodHandlers<
                wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject,
                wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject>(
                  this, METHODID_REQUEST)))
          .addMethod(
            getInitMethod(),
            asyncServerStreamingCall(
              new MethodHandlers<
                wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig,
                wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse>(
                  this, METHODID_INIT)))
          .build();
    }
  }

  /**
   */
  public static final class PadPlusServerStub extends io.grpc.stub.AbstractAsyncStub<PadPlusServerStub> {
    private PadPlusServerStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected PadPlusServerStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new PadPlusServerStub(channel, callOptions);
    }

    /**
     */
    public void request(wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject request,
        io.grpc.stub.StreamObserver<wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getRequestMethod(), getCallOptions()), request, responseObserver);
    }

    /**
     */
    public void init(wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig request,
        io.grpc.stub.StreamObserver<wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse> responseObserver) {
      asyncServerStreamingCall(
          getChannel().newCall(getInitMethod(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class PadPlusServerBlockingStub extends io.grpc.stub.AbstractBlockingStub<PadPlusServerBlockingStub> {
    private PadPlusServerBlockingStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected PadPlusServerBlockingStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new PadPlusServerBlockingStub(channel, callOptions);
    }

    /**
     */
    public wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject request(wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject request) {
      return blockingUnaryCall(
          getChannel(), getRequestMethod(), getCallOptions(), request);
    }

    /**
     */
    public java.util.Iterator<wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse> init(
        wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig request) {
      return blockingServerStreamingCall(
          getChannel(), getInitMethod(), getCallOptions(), request);
    }
  }

  /**
   */
  public static final class PadPlusServerFutureStub extends io.grpc.stub.AbstractFutureStub<PadPlusServerFutureStub> {
    private PadPlusServerFutureStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected PadPlusServerFutureStub build(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      return new PadPlusServerFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject> request(
        wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject request) {
      return futureUnaryCall(
          getChannel().newCall(getRequestMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_REQUEST = 0;
  private static final int METHODID_INIT = 1;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final PadPlusServerImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(PadPlusServerImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_REQUEST:
          serviceImpl.request((wechaty.padplus.grpc.PadPlusServerOuterClass.RequestObject) request,
              (io.grpc.stub.StreamObserver<wechaty.padplus.grpc.PadPlusServerOuterClass.ResponseObject>) responseObserver);
          break;
        case METHODID_INIT:
          serviceImpl.init((wechaty.padplus.grpc.PadPlusServerOuterClass.InitConfig) request,
              (io.grpc.stub.StreamObserver<wechaty.padplus.grpc.PadPlusServerOuterClass.StreamResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class PadPlusServerBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    PadPlusServerBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return wechaty.padplus.grpc.PadPlusServerOuterClass.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("PadPlusServer");
    }
  }

  private static final class PadPlusServerFileDescriptorSupplier
      extends PadPlusServerBaseDescriptorSupplier {
    PadPlusServerFileDescriptorSupplier() {}
  }

  private static final class PadPlusServerMethodDescriptorSupplier
      extends PadPlusServerBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    PadPlusServerMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (PadPlusServerGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new PadPlusServerFileDescriptorSupplier())
              .addMethod(getRequestMethod())
              .addMethod(getInitMethod())
              .build();
        }
      }
    }
    return result;
  }
}