All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.freemanan.sample.pet.v1.PetServiceGrpc Maven / Gradle / Ivy

The newest version!
package com.freemanan.sample.pet.v1;

import static io.grpc.MethodDescriptor.generateFullMethodName;

/**
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.59.1)",
    comments = "Source: sample/pet/v1/pet.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class PetServiceGrpc {

  private PetServiceGrpc() {}

  public static final java.lang.String SERVICE_NAME = "sample.pet.v1.PetService";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor getGetPetMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "GetPet",
      requestType = com.freemanan.sample.pet.v1.GetPetRequest.class,
      responseType = com.freemanan.sample.pet.v1.Pet.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor getGetPetMethod() {
    io.grpc.MethodDescriptor getGetPetMethod;
    if ((getGetPetMethod = PetServiceGrpc.getGetPetMethod) == null) {
      synchronized (PetServiceGrpc.class) {
        if ((getGetPetMethod = PetServiceGrpc.getGetPetMethod) == null) {
          PetServiceGrpc.getGetPetMethod = getGetPetMethod =
              io.grpc.MethodDescriptor.newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetPet"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.freemanan.sample.pet.v1.GetPetRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.freemanan.sample.pet.v1.Pet.getDefaultInstance()))
              .setSchemaDescriptor(new PetServiceMethodDescriptorSupplier("GetPet"))
              .build();
        }
      }
    }
    return getGetPetMethod;
  }

  private static volatile io.grpc.MethodDescriptor getGetPetNameMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "GetPetName",
      requestType = com.google.protobuf.StringValue.class,
      responseType = com.google.protobuf.StringValue.class,
      methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
  public static io.grpc.MethodDescriptor getGetPetNameMethod() {
    io.grpc.MethodDescriptor getGetPetNameMethod;
    if ((getGetPetNameMethod = PetServiceGrpc.getGetPetNameMethod) == null) {
      synchronized (PetServiceGrpc.class) {
        if ((getGetPetNameMethod = PetServiceGrpc.getGetPetNameMethod) == null) {
          PetServiceGrpc.getGetPetNameMethod = getGetPetNameMethod =
              io.grpc.MethodDescriptor.newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetPetName"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.google.protobuf.StringValue.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.google.protobuf.StringValue.getDefaultInstance()))
              .setSchemaDescriptor(new PetServiceMethodDescriptorSupplier("GetPetName"))
              .build();
        }
      }
    }
    return getGetPetNameMethod;
  }

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

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

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

  /**
   */
  public interface AsyncService {

    /**
     */
    default void getPet(com.freemanan.sample.pet.v1.GetPetRequest request,
        io.grpc.stub.StreamObserver responseObserver) {
      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetPetMethod(), responseObserver);
    }

    /**
     */
    default void getPetName(com.google.protobuf.StringValue request,
        io.grpc.stub.StreamObserver responseObserver) {
      io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetPetNameMethod(), responseObserver);
    }
  }

  /**
   * Base class for the server implementation of the service PetService.
   */
  public static abstract class PetServiceImplBase
      implements io.grpc.BindableService, AsyncService {

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return PetServiceGrpc.bindService(this);
    }
  }

  /**
   * A stub to allow clients to do asynchronous rpc calls to service PetService.
   */
  public static final class PetServiceStub
      extends io.grpc.stub.AbstractAsyncStub {
    private PetServiceStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

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

    /**
     */
    public void getPet(com.freemanan.sample.pet.v1.GetPetRequest request,
        io.grpc.stub.StreamObserver responseObserver) {
      io.grpc.stub.ClientCalls.asyncUnaryCall(
          getChannel().newCall(getGetPetMethod(), getCallOptions()), request, responseObserver);
    }

    /**
     */
    public void getPetName(com.google.protobuf.StringValue request,
        io.grpc.stub.StreamObserver responseObserver) {
      io.grpc.stub.ClientCalls.asyncUnaryCall(
          getChannel().newCall(getGetPetNameMethod(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   * A stub to allow clients to do synchronous rpc calls to service PetService.
   */
  public static final class PetServiceBlockingStub
      extends io.grpc.stub.AbstractBlockingStub {
    private PetServiceBlockingStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

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

    /**
     */
    public com.freemanan.sample.pet.v1.Pet getPet(com.freemanan.sample.pet.v1.GetPetRequest request) {
      return io.grpc.stub.ClientCalls.blockingUnaryCall(
          getChannel(), getGetPetMethod(), getCallOptions(), request);
    }

    /**
     */
    public com.google.protobuf.StringValue getPetName(com.google.protobuf.StringValue request) {
      return io.grpc.stub.ClientCalls.blockingUnaryCall(
          getChannel(), getGetPetNameMethod(), getCallOptions(), request);
    }
  }

  /**
   * A stub to allow clients to do ListenableFuture-style rpc calls to service PetService.
   */
  public static final class PetServiceFutureStub
      extends io.grpc.stub.AbstractFutureStub {
    private PetServiceFutureStub(
        io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

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

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture getPet(
        com.freemanan.sample.pet.v1.GetPetRequest request) {
      return io.grpc.stub.ClientCalls.futureUnaryCall(
          getChannel().newCall(getGetPetMethod(), getCallOptions()), request);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture getPetName(
        com.google.protobuf.StringValue request) {
      return io.grpc.stub.ClientCalls.futureUnaryCall(
          getChannel().newCall(getGetPetNameMethod(), getCallOptions()), request);
    }
  }

  private static final int METHODID_GET_PET = 0;
  private static final int METHODID_GET_PET_NAME = 1;

  private static final class MethodHandlers implements
      io.grpc.stub.ServerCalls.UnaryMethod,
      io.grpc.stub.ServerCalls.ServerStreamingMethod,
      io.grpc.stub.ServerCalls.ClientStreamingMethod,
      io.grpc.stub.ServerCalls.BidiStreamingMethod {
    private final AsyncService serviceImpl;
    private final int methodId;

    MethodHandlers(AsyncService 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 responseObserver) {
      switch (methodId) {
        case METHODID_GET_PET:
          serviceImpl.getPet((com.freemanan.sample.pet.v1.GetPetRequest) request,
              (io.grpc.stub.StreamObserver) responseObserver);
          break;
        case METHODID_GET_PET_NAME:
          serviceImpl.getPetName((com.google.protobuf.StringValue) request,
              (io.grpc.stub.StreamObserver) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

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

  public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
    return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
        .addMethod(
          getGetPetMethod(),
          io.grpc.stub.ServerCalls.asyncUnaryCall(
            new MethodHandlers<
              com.freemanan.sample.pet.v1.GetPetRequest,
              com.freemanan.sample.pet.v1.Pet>(
                service, METHODID_GET_PET)))
        .addMethod(
          getGetPetNameMethod(),
          io.grpc.stub.ServerCalls.asyncUnaryCall(
            new MethodHandlers<
              com.google.protobuf.StringValue,
              com.google.protobuf.StringValue>(
                service, METHODID_GET_PET_NAME)))
        .build();
  }

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

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.freemanan.sample.pet.v1.PetOuterClass.getDescriptor();
    }

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

  private static final class PetServiceFileDescriptorSupplier
      extends PetServiceBaseDescriptorSupplier {
    PetServiceFileDescriptorSupplier() {}
  }

  private static final class PetServiceMethodDescriptorSupplier
      extends PetServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final java.lang.String methodName;

    PetServiceMethodDescriptorSupplier(java.lang.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 (PetServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new PetServiceFileDescriptorSupplier())
              .addMethod(getGetPetMethod())
              .addMethod(getGetPetNameMethod())
              .build();
        }
      }
    }
    return result;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy