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

com.vision4j.classification.grpc.ClassificationGrpc Maven / Gradle / Ivy

The newest version!
package com.vision4j.classification.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.11.0)",
    comments = "Source: classification.proto")
public final class ClassificationGrpc {

  private ClassificationGrpc() {}

  public static final String SERVICE_NAME = "classification.Classification";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @java.lang.Deprecated // Use {@link #getPredictMethod()} instead. 
  public static final io.grpc.MethodDescriptor METHOD_PREDICT = getPredictMethodHelper();

  private static volatile io.grpc.MethodDescriptor getPredictMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor getPredictMethod() {
    return getPredictMethodHelper();
  }

  private static io.grpc.MethodDescriptor getPredictMethodHelper() {
    io.grpc.MethodDescriptor getPredictMethod;
    if ((getPredictMethod = ClassificationGrpc.getPredictMethod) == null) {
      synchronized (ClassificationGrpc.class) {
        if ((getPredictMethod = ClassificationGrpc.getPredictMethod) == null) {
          ClassificationGrpc.getPredictMethod = getPredictMethod = 
              io.grpc.MethodDescriptor.newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "classification.Classification", "Predict"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.vision4j.classification.grpc.Image.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.vision4j.classification.grpc.Prediction.getDefaultInstance()))
                  .setSchemaDescriptor(new ClassificationMethodDescriptorSupplier("Predict"))
                  .build();
          }
        }
     }
     return getPredictMethod;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static ClassificationStub newStub(io.grpc.Channel channel) {
    return new ClassificationStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static ClassificationBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new ClassificationBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static ClassificationFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new ClassificationFutureStub(channel);
  }

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

    /**
     */
    public void predict(com.vision4j.classification.grpc.Image request,
        io.grpc.stub.StreamObserver responseObserver) {
      asyncUnimplementedUnaryCall(getPredictMethodHelper(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getPredictMethodHelper(),
            asyncUnaryCall(
              new MethodHandlers<
                com.vision4j.classification.grpc.Image,
                com.vision4j.classification.grpc.Prediction>(
                  this, METHODID_PREDICT)))
          .build();
    }
  }

  /**
   */
  public static final class ClassificationStub extends io.grpc.stub.AbstractStub {
    private ClassificationStub(io.grpc.Channel channel) {
      super(channel);
    }

    private ClassificationStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

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

    /**
     */
    public void predict(com.vision4j.classification.grpc.Image request,
        io.grpc.stub.StreamObserver responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getPredictMethodHelper(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   */
  public static final class ClassificationBlockingStub extends io.grpc.stub.AbstractStub {
    private ClassificationBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private ClassificationBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

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

    /**
     */
    public com.vision4j.classification.grpc.Prediction predict(com.vision4j.classification.grpc.Image request) {
      return blockingUnaryCall(
          getChannel(), getPredictMethodHelper(), getCallOptions(), request);
    }
  }

  /**
   */
  public static final class ClassificationFutureStub extends io.grpc.stub.AbstractStub {
    private ClassificationFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private ClassificationFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

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

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture predict(
        com.vision4j.classification.grpc.Image request) {
      return futureUnaryCall(
          getChannel().newCall(getPredictMethodHelper(), getCallOptions()), request);
    }
  }

  private static final int METHODID_PREDICT = 0;

  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 ClassificationImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(ClassificationImplBase 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_PREDICT:
          serviceImpl.predict((com.vision4j.classification.grpc.Image) 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();
      }
    }
  }

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

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.vision4j.classification.grpc.ClassificationProto.getDescriptor();
    }

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

  private static final class ClassificationFileDescriptorSupplier
      extends ClassificationBaseDescriptorSupplier {
    ClassificationFileDescriptorSupplier() {}
  }

  private static final class ClassificationMethodDescriptorSupplier
      extends ClassificationBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    ClassificationMethodDescriptorSupplier(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 (ClassificationGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new ClassificationFileDescriptorSupplier())
              .addMethod(getPredictMethodHelper())
              .build();
        }
      }
    }
    return result;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy