...

Text file src/github.com/google/flatbuffers/tests/MyGame/Example/MonsterStorageGrpc.java

Documentation: github.com/google/flatbuffers/tests/MyGame/Example

     1//Generated by flatc compiler (version 2.0.0)
     2//If you make any local changes, they will be lost
     3//source: monster_test.fbs
     4
     5package MyGame.Example;
     6
     7import com.google.flatbuffers.grpc.FlatbuffersUtils;
     8
     9import java.nio.ByteBuffer;
    10import static io.grpc.MethodDescriptor.generateFullMethodName;
    11import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
    12import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
    13import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
    14import static io.grpc.stub.ClientCalls.asyncUnaryCall;
    15import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
    16import static io.grpc.stub.ClientCalls.blockingUnaryCall;
    17import static io.grpc.stub.ClientCalls.futureUnaryCall;
    18import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
    19import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
    20import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
    21import static io.grpc.stub.ServerCalls.asyncUnaryCall;
    22import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
    23import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
    24
    25/**
    26 */
    27@javax.annotation.Generated(
    28    value = "by gRPC proto compiler",
    29    comments = "Source: monster_test.fbs")
    30public final class MonsterStorageGrpc {
    31
    32  private MonsterStorageGrpc() {}
    33  
    34  public static final String SERVICE_NAME = "MyGame.Example.MonsterStorage";
    35  
    36  // Static method descriptors that strictly reflect the proto.
    37  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
    38  @java.lang.Deprecated // Use {@link #getStoreMethod()} instead. 
    39  public static final io.grpc.MethodDescriptor<MyGame.Example.Monster,
    40      MyGame.Example.Stat> METHOD_STORE = getStoreMethod();
    41  
    42  private static volatile io.grpc.MethodDescriptor<MyGame.Example.Monster,
    43      MyGame.Example.Stat> getStoreMethod;
    44  
    45  private static volatile FlatbuffersUtils.FBExtactor<MyGame.Example.Monster> extractorOfMonster;
    46  private static FlatbuffersUtils.FBExtactor<MyGame.Example.Monster> getExtractorOfMonster() {
    47      if (extractorOfMonster != null) return extractorOfMonster;
    48      synchronized (MonsterStorageGrpc.class) {
    49          if (extractorOfMonster != null) return extractorOfMonster;
    50          extractorOfMonster = new FlatbuffersUtils.FBExtactor<MyGame.Example.Monster>() {
    51              public MyGame.Example.Monster extract (ByteBuffer buffer) {
    52                  return MyGame.Example.Monster.getRootAsMonster(buffer);
    53              }
    54          };
    55          return extractorOfMonster;
    56      }
    57  }
    58  
    59  private static volatile FlatbuffersUtils.FBExtactor<MyGame.Example.Stat> extractorOfStat;
    60  private static FlatbuffersUtils.FBExtactor<MyGame.Example.Stat> getExtractorOfStat() {
    61      if (extractorOfStat != null) return extractorOfStat;
    62      synchronized (MonsterStorageGrpc.class) {
    63          if (extractorOfStat != null) return extractorOfStat;
    64          extractorOfStat = new FlatbuffersUtils.FBExtactor<MyGame.Example.Stat>() {
    65              public MyGame.Example.Stat extract (ByteBuffer buffer) {
    66                  return MyGame.Example.Stat.getRootAsStat(buffer);
    67              }
    68          };
    69          return extractorOfStat;
    70      }
    71  }
    72  
    73  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
    74  public static io.grpc.MethodDescriptor<MyGame.Example.Monster,
    75      MyGame.Example.Stat> getStoreMethod() {
    76    io.grpc.MethodDescriptor<MyGame.Example.Monster, MyGame.Example.Stat> getStoreMethod;
    77    if ((getStoreMethod = MonsterStorageGrpc.getStoreMethod) == null) {
    78      synchronized (MonsterStorageGrpc.class) {
    79        if ((getStoreMethod = MonsterStorageGrpc.getStoreMethod) == null) {
    80          MonsterStorageGrpc.getStoreMethod = getStoreMethod = 
    81              io.grpc.MethodDescriptor.<MyGame.Example.Monster, MyGame.Example.Stat>newBuilder()
    82              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
    83              .setFullMethodName(generateFullMethodName(
    84                  "MyGame.Example.MonsterStorage", "Store"))
    85              .setSampledToLocalTracing(true)
    86              .setRequestMarshaller(FlatbuffersUtils.marshaller(
    87                  MyGame.Example.Monster.class, getExtractorOfMonster()))
    88              .setResponseMarshaller(FlatbuffersUtils.marshaller(
    89                  MyGame.Example.Stat.class, getExtractorOfStat()))
    90                  .setSchemaDescriptor(null)
    91                  .build();
    92          }
    93        }
    94     }
    95     return getStoreMethod;
    96  }
    97  
    98  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
    99  @java.lang.Deprecated // Use {@link #getRetrieveMethod()} instead. 
   100  public static final io.grpc.MethodDescriptor<MyGame.Example.Stat,
   101      MyGame.Example.Monster> METHOD_RETRIEVE = getRetrieveMethod();
   102  
   103  private static volatile io.grpc.MethodDescriptor<MyGame.Example.Stat,
   104      MyGame.Example.Monster> getRetrieveMethod;
   105  
   106  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
   107  public static io.grpc.MethodDescriptor<MyGame.Example.Stat,
   108      MyGame.Example.Monster> getRetrieveMethod() {
   109    io.grpc.MethodDescriptor<MyGame.Example.Stat, MyGame.Example.Monster> getRetrieveMethod;
   110    if ((getRetrieveMethod = MonsterStorageGrpc.getRetrieveMethod) == null) {
   111      synchronized (MonsterStorageGrpc.class) {
   112        if ((getRetrieveMethod = MonsterStorageGrpc.getRetrieveMethod) == null) {
   113          MonsterStorageGrpc.getRetrieveMethod = getRetrieveMethod = 
   114              io.grpc.MethodDescriptor.<MyGame.Example.Stat, MyGame.Example.Monster>newBuilder()
   115              .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
   116              .setFullMethodName(generateFullMethodName(
   117                  "MyGame.Example.MonsterStorage", "Retrieve"))
   118              .setSampledToLocalTracing(true)
   119              .setRequestMarshaller(FlatbuffersUtils.marshaller(
   120                  MyGame.Example.Stat.class, getExtractorOfStat()))
   121              .setResponseMarshaller(FlatbuffersUtils.marshaller(
   122                  MyGame.Example.Monster.class, getExtractorOfMonster()))
   123                  .setSchemaDescriptor(null)
   124                  .build();
   125          }
   126        }
   127     }
   128     return getRetrieveMethod;
   129  }
   130  
   131  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
   132  @java.lang.Deprecated // Use {@link #getGetMaxHitPointMethod()} instead. 
   133  public static final io.grpc.MethodDescriptor<MyGame.Example.Monster,
   134      MyGame.Example.Stat> METHOD_GET_MAX_HIT_POINT = getGetMaxHitPointMethod();
   135  
   136  private static volatile io.grpc.MethodDescriptor<MyGame.Example.Monster,
   137      MyGame.Example.Stat> getGetMaxHitPointMethod;
   138  
   139  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
   140  public static io.grpc.MethodDescriptor<MyGame.Example.Monster,
   141      MyGame.Example.Stat> getGetMaxHitPointMethod() {
   142    io.grpc.MethodDescriptor<MyGame.Example.Monster, MyGame.Example.Stat> getGetMaxHitPointMethod;
   143    if ((getGetMaxHitPointMethod = MonsterStorageGrpc.getGetMaxHitPointMethod) == null) {
   144      synchronized (MonsterStorageGrpc.class) {
   145        if ((getGetMaxHitPointMethod = MonsterStorageGrpc.getGetMaxHitPointMethod) == null) {
   146          MonsterStorageGrpc.getGetMaxHitPointMethod = getGetMaxHitPointMethod = 
   147              io.grpc.MethodDescriptor.<MyGame.Example.Monster, MyGame.Example.Stat>newBuilder()
   148              .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
   149              .setFullMethodName(generateFullMethodName(
   150                  "MyGame.Example.MonsterStorage", "GetMaxHitPoint"))
   151              .setSampledToLocalTracing(true)
   152              .setRequestMarshaller(FlatbuffersUtils.marshaller(
   153                  MyGame.Example.Monster.class, getExtractorOfMonster()))
   154              .setResponseMarshaller(FlatbuffersUtils.marshaller(
   155                  MyGame.Example.Stat.class, getExtractorOfStat()))
   156                  .setSchemaDescriptor(null)
   157                  .build();
   158          }
   159        }
   160     }
   161     return getGetMaxHitPointMethod;
   162  }
   163  
   164  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
   165  @java.lang.Deprecated // Use {@link #getGetMinMaxHitPointsMethod()} instead. 
   166  public static final io.grpc.MethodDescriptor<MyGame.Example.Monster,
   167      MyGame.Example.Stat> METHOD_GET_MIN_MAX_HIT_POINTS = getGetMinMaxHitPointsMethod();
   168  
   169  private static volatile io.grpc.MethodDescriptor<MyGame.Example.Monster,
   170      MyGame.Example.Stat> getGetMinMaxHitPointsMethod;
   171  
   172  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
   173  public static io.grpc.MethodDescriptor<MyGame.Example.Monster,
   174      MyGame.Example.Stat> getGetMinMaxHitPointsMethod() {
   175    io.grpc.MethodDescriptor<MyGame.Example.Monster, MyGame.Example.Stat> getGetMinMaxHitPointsMethod;
   176    if ((getGetMinMaxHitPointsMethod = MonsterStorageGrpc.getGetMinMaxHitPointsMethod) == null) {
   177      synchronized (MonsterStorageGrpc.class) {
   178        if ((getGetMinMaxHitPointsMethod = MonsterStorageGrpc.getGetMinMaxHitPointsMethod) == null) {
   179          MonsterStorageGrpc.getGetMinMaxHitPointsMethod = getGetMinMaxHitPointsMethod = 
   180              io.grpc.MethodDescriptor.<MyGame.Example.Monster, MyGame.Example.Stat>newBuilder()
   181              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
   182              .setFullMethodName(generateFullMethodName(
   183                  "MyGame.Example.MonsterStorage", "GetMinMaxHitPoints"))
   184              .setSampledToLocalTracing(true)
   185              .setRequestMarshaller(FlatbuffersUtils.marshaller(
   186                  MyGame.Example.Monster.class, getExtractorOfMonster()))
   187              .setResponseMarshaller(FlatbuffersUtils.marshaller(
   188                  MyGame.Example.Stat.class, getExtractorOfStat()))
   189                  .setSchemaDescriptor(null)
   190                  .build();
   191          }
   192        }
   193     }
   194     return getGetMinMaxHitPointsMethod;
   195  }
   196  
   197  /**
   198   * Creates a new async stub that supports all call types for the service
   199   */
   200  public static MonsterStorageStub newStub(io.grpc.Channel channel) {
   201    return new MonsterStorageStub(channel);
   202  }
   203  
   204  /**
   205   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   206   */
   207  public static MonsterStorageBlockingStub newBlockingStub(
   208      io.grpc.Channel channel) {
   209    return new MonsterStorageBlockingStub(channel);
   210  }
   211  
   212  /**
   213   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   214   */
   215  public static MonsterStorageFutureStub newFutureStub(
   216      io.grpc.Channel channel) {
   217    return new MonsterStorageFutureStub(channel);
   218  }
   219  
   220  /**
   221   */
   222  public static abstract class MonsterStorageImplBase implements io.grpc.BindableService {
   223    
   224    /**
   225     */
   226    public     void store(MyGame.Example.Monster request,
   227        io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver)     {
   228      asyncUnimplementedUnaryCall(getStoreMethod(), responseObserver);
   229    }
   230    
   231    /**
   232     */
   233    public     void retrieve(MyGame.Example.Stat request,
   234        io.grpc.stub.StreamObserver<MyGame.Example.Monster> responseObserver)     {
   235      asyncUnimplementedUnaryCall(getRetrieveMethod(), responseObserver);
   236    }
   237    
   238    /**
   239     */
   240    public     io.grpc.stub.StreamObserver<MyGame.Example.Monster> getMaxHitPoint(
   241        io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver)     {
   242      return asyncUnimplementedStreamingCall(getGetMaxHitPointMethod(), responseObserver);
   243    }
   244    
   245    /**
   246     */
   247    public     io.grpc.stub.StreamObserver<MyGame.Example.Monster> getMinMaxHitPoints(
   248        io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver)     {
   249      return asyncUnimplementedStreamingCall(getGetMinMaxHitPointsMethod(), responseObserver);
   250    }
   251    
   252    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
   253      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
   254          .addMethod(
   255            getStoreMethod(),
   256            asyncUnaryCall(
   257              new MethodHandlers<
   258                MyGame.Example.Monster,
   259                MyGame.Example.Stat>(
   260                  this, METHODID_STORE)))
   261          .addMethod(
   262            getRetrieveMethod(),
   263            asyncServerStreamingCall(
   264              new MethodHandlers<
   265                MyGame.Example.Stat,
   266                MyGame.Example.Monster>(
   267                  this, METHODID_RETRIEVE)))
   268          .addMethod(
   269            getGetMaxHitPointMethod(),
   270            asyncClientStreamingCall(
   271              new MethodHandlers<
   272                MyGame.Example.Monster,
   273                MyGame.Example.Stat>(
   274                  this, METHODID_GET_MAX_HIT_POINT)))
   275          .addMethod(
   276            getGetMinMaxHitPointsMethod(),
   277            asyncBidiStreamingCall(
   278              new MethodHandlers<
   279                MyGame.Example.Monster,
   280                MyGame.Example.Stat>(
   281                  this, METHODID_GET_MIN_MAX_HIT_POINTS)))
   282          .build();
   283    }
   284  }
   285  
   286  /**
   287   */
   288  public static final class MonsterStorageStub extends io.grpc.stub.AbstractStub<MonsterStorageStub> {
   289    private MonsterStorageStub(io.grpc.Channel channel) {
   290      super(channel);
   291    }
   292    
   293    private MonsterStorageStub(io.grpc.Channel channel,
   294        io.grpc.CallOptions callOptions) {
   295      super(channel, callOptions);
   296    }
   297    
   298    @java.lang.Override
   299    protected MonsterStorageStub build(io.grpc.Channel channel,
   300        io.grpc.CallOptions callOptions) {
   301      return new MonsterStorageStub(channel, callOptions);
   302    }
   303    
   304    /**
   305     */
   306    public     void store(MyGame.Example.Monster request,
   307        io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver)     {
   308      asyncUnaryCall(
   309          getChannel().newCall(getStoreMethod(), getCallOptions()), request, responseObserver);
   310    }
   311    
   312    /**
   313     */
   314    public     void retrieve(MyGame.Example.Stat request,
   315        io.grpc.stub.StreamObserver<MyGame.Example.Monster> responseObserver)     {
   316      asyncServerStreamingCall(
   317          getChannel().newCall(getRetrieveMethod(), getCallOptions()), request, responseObserver);
   318    }
   319    
   320    /**
   321     */
   322    public     io.grpc.stub.StreamObserver<MyGame.Example.Monster> getMaxHitPoint(
   323        io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver)     {
   324      return asyncClientStreamingCall(
   325          getChannel().newCall(getGetMaxHitPointMethod(), getCallOptions()), responseObserver);
   326    }
   327    
   328    /**
   329     */
   330    public     io.grpc.stub.StreamObserver<MyGame.Example.Monster> getMinMaxHitPoints(
   331        io.grpc.stub.StreamObserver<MyGame.Example.Stat> responseObserver)     {
   332      return asyncBidiStreamingCall(
   333          getChannel().newCall(getGetMinMaxHitPointsMethod(), getCallOptions()), responseObserver);
   334    }
   335  }
   336  
   337  /**
   338   */
   339  public static final class MonsterStorageBlockingStub extends io.grpc.stub.AbstractStub<MonsterStorageBlockingStub> {
   340    private MonsterStorageBlockingStub(io.grpc.Channel channel) {
   341      super(channel);
   342    }
   343    
   344    private MonsterStorageBlockingStub(io.grpc.Channel channel,
   345        io.grpc.CallOptions callOptions) {
   346      super(channel, callOptions);
   347    }
   348    
   349    @java.lang.Override
   350    protected MonsterStorageBlockingStub build(io.grpc.Channel channel,
   351        io.grpc.CallOptions callOptions) {
   352      return new MonsterStorageBlockingStub(channel, callOptions);
   353    }
   354    
   355    /**
   356     */
   357    public     MyGame.Example.Stat store(MyGame.Example.Monster request)     {
   358      return blockingUnaryCall(
   359          getChannel(), getStoreMethod(), getCallOptions(), request);
   360    }
   361    
   362    /**
   363     */
   364    public     java.util.Iterator<MyGame.Example.Monster> retrieve(
   365        MyGame.Example.Stat request)     {
   366      return blockingServerStreamingCall(
   367          getChannel(), getRetrieveMethod(), getCallOptions(), request);
   368    }
   369  }
   370  
   371  /**
   372   */
   373  public static final class MonsterStorageFutureStub extends io.grpc.stub.AbstractStub<MonsterStorageFutureStub> {
   374    private MonsterStorageFutureStub(io.grpc.Channel channel) {
   375      super(channel);
   376    }
   377    
   378    private MonsterStorageFutureStub(io.grpc.Channel channel,
   379        io.grpc.CallOptions callOptions) {
   380      super(channel, callOptions);
   381    }
   382    
   383    @java.lang.Override
   384    protected MonsterStorageFutureStub build(io.grpc.Channel channel,
   385        io.grpc.CallOptions callOptions) {
   386      return new MonsterStorageFutureStub(channel, callOptions);
   387    }
   388    
   389    /**
   390     */
   391    public     com.google.common.util.concurrent.ListenableFuture<MyGame.Example.Stat> store(
   392        MyGame.Example.Monster request)     {
   393      return futureUnaryCall(
   394          getChannel().newCall(getStoreMethod(), getCallOptions()), request);
   395    }
   396  }
   397  
   398  private static final int METHODID_STORE = 0;
   399  private static final int METHODID_RETRIEVE = 1;
   400  private static final int METHODID_GET_MIN_MAX_HIT_POINTS = 2;
   401  private static final int METHODID_GET_MAX_HIT_POINT = 3;
   402  
   403  private static final class MethodHandlers<Req, Resp> implements
   404      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
   405      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
   406      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
   407      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
   408    private final MonsterStorageImplBase serviceImpl;
   409    private final int methodId;
   410  
   411    MethodHandlers(MonsterStorageImplBase serviceImpl, int methodId) {
   412      this.serviceImpl = serviceImpl;
   413      this.methodId = methodId;
   414    }
   415  
   416    @java.lang.Override
   417    @java.lang.SuppressWarnings("unchecked")
   418    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
   419      switch (methodId) {
   420        case METHODID_STORE:
   421          serviceImpl.store((MyGame.Example.Monster) request,
   422              (io.grpc.stub.StreamObserver<MyGame.Example.Stat>) responseObserver);
   423          break;
   424        case METHODID_RETRIEVE:
   425          serviceImpl.retrieve((MyGame.Example.Stat) request,
   426              (io.grpc.stub.StreamObserver<MyGame.Example.Monster>) responseObserver);
   427          break;
   428        default:
   429          throw new AssertionError();
   430      }
   431    }
   432    
   433    @java.lang.Override
   434    @java.lang.SuppressWarnings("unchecked")
   435    public io.grpc.stub.StreamObserver<Req> invoke(
   436        io.grpc.stub.StreamObserver<Resp> responseObserver) {
   437      switch (methodId) {
   438        case METHODID_GET_MAX_HIT_POINT:
   439          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.getMaxHitPoint(
   440              (io.grpc.stub.StreamObserver<MyGame.Example.Stat>) responseObserver);
   441        case METHODID_GET_MIN_MAX_HIT_POINTS:
   442          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.getMinMaxHitPoints(
   443              (io.grpc.stub.StreamObserver<MyGame.Example.Stat>) responseObserver);
   444        default:
   445          throw new AssertionError();
   446      }
   447    }
   448  }
   449  
   450  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
   451  
   452  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
   453    io.grpc.ServiceDescriptor result = serviceDescriptor;
   454    if (result == null) {
   455      synchronized (MonsterStorageGrpc.class) {
   456        result = serviceDescriptor;
   457        if (result == null) {
   458          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)              
   459              .setSchemaDescriptor(null)              
   460              .addMethod(getStoreMethod())              
   461              .addMethod(getRetrieveMethod())              
   462              .addMethod(getGetMaxHitPointMethod())              
   463              .addMethod(getGetMinMaxHitPointsMethod())              
   464              .build();
   465        }
   466      }
   467    }
   468    return result;
   469  }
   470}

View as plain text