e.servicelibs.reactor-grpc.0.10.0-RC1.source-code.ReactorStub.mustache Maven / Gradle / Ivy
{{#packageName}}
package {{packageName}};
{{/packageName}}
import static {{packageName}}.{{serviceName}}Grpc.getServiceDescriptor;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
{{#deprecated}}
@java.lang.Deprecated
{{/deprecated}}
@javax.annotation.Generated(
value = "by ReactorGrpc generator",
comments = "Source: {{protoName}}")
public final class {{className}} {
private {{className}}() {}
public static Reactor{{serviceName}}Stub newReactorStub(io.grpc.Channel channel) {
return new Reactor{{serviceName}}Stub(channel);
}
{{#javaDoc}}
{{{javaDoc}}}
{{/javaDoc}}
public static final class Reactor{{serviceName}}Stub extends io.grpc.stub.AbstractStub {
private {{serviceName}}Grpc.{{serviceName}}Stub delegateStub;
private Reactor{{serviceName}}Stub(io.grpc.Channel channel) {
super(channel);
delegateStub = {{serviceName}}Grpc.newStub(channel);
}
private Reactor{{serviceName}}Stub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
delegateStub = {{serviceName}}Grpc.newStub(channel).build(channel, callOptions);
}
@Override
protected Reactor{{serviceName}}Stub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new Reactor{{serviceName}}Stub(channel, callOptions);
}
{{#methods}}
{{#javaDoc}}
{{{javaDoc}}}
{{/javaDoc}}
{{#deprecated}}
@java.lang.Deprecated
{{/deprecated}}
public {{#isManyOutput}}reactor.core.publisher.Flux{{/isManyOutput}}{{^isManyOutput}}reactor.core.publisher.Mono{{/isManyOutput}}<{{outputType}}> {{methodName}}({{#isManyInput}}reactor.core.publisher.Flux{{/isManyInput}}{{^isManyInput}}reactor.core.publisher.Mono{{/isManyInput}}<{{inputType}}> reactorRequest) {
return com.salesforce.reactorgrpc.stub.ClientCalls.{{reactiveCallsMethodName}}(reactorRequest, delegateStub::{{methodName}});
}
{{/methods}}
{{#unaryRequestMethods}}
{{#javaDoc}}
{{{javaDoc}}}
{{/javaDoc}}
{{#deprecated}}
@java.lang.Deprecated
{{/deprecated}}
public {{#isManyOutput}}reactor.core.publisher.Flux{{/isManyOutput}}{{^isManyOutput}}reactor.core.publisher.Mono{{/isManyOutput}}<{{outputType}}> {{methodName}}({{inputType}} reactorRequest) {
return com.salesforce.reactorgrpc.stub.ClientCalls.{{reactiveCallsMethodName}}(reactor.core.publisher.Mono.just(reactorRequest), delegateStub::{{methodName}});
}
{{/unaryRequestMethods}}
}
{{#javaDoc}}
{{{javaDoc}}}
{{/javaDoc}}
public static abstract class {{serviceName}}ImplBase implements io.grpc.BindableService {
{{#methods}}
{{#javaDoc}}
{{{javaDoc}}}
{{/javaDoc}}
{{#deprecated}}
@java.lang.Deprecated
{{/deprecated}}
public {{#isManyOutput}}reactor.core.publisher.Flux{{/isManyOutput}}{{^isManyOutput}}reactor.core.publisher.Mono{{/isManyOutput}}<{{outputType}}> {{methodName}}({{#isManyInput}}reactor.core.publisher.Flux{{/isManyInput}}{{^isManyInput}}reactor.core.publisher.Mono{{/isManyInput}}<{{inputType}}> request) {
throw new io.grpc.StatusRuntimeException(io.grpc.Status.UNIMPLEMENTED);
}
{{/methods}}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
{{#methods}}
.addMethod(
{{packageName}}.{{serviceName}}Grpc.get{{methodNamePascalCase}}Method(),
{{grpcCallsMethodName}}(
new MethodHandlers<
{{inputType}},
{{outputType}}>(
this, METHODID_{{methodNameUpperUnderscore}})))
{{/methods}}
.build();
}
}
{{#methods}}
private static final int METHODID_{{methodNameUpperUnderscore}} = {{methodNumber}};
{{/methods}}
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 {{serviceName}}ImplBase serviceImpl;
private final int methodId;
MethodHandlers({{serviceName}}ImplBase 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) {
{{#methods}}
{{^isManyInput}}
case METHODID_{{methodNameUpperUnderscore}}:
com.salesforce.reactorgrpc.stub.ServerCalls.{{reactiveCallsMethodName}}(({{inputType}}) request,
(io.grpc.stub.StreamObserver<{{outputType}}>) responseObserver,
serviceImpl::{{methodName}});
break;
{{/isManyInput}}
{{/methods}}
default:
throw new java.lang.AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver invoke(io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
{{#methods}}
{{#isManyInput}}
case METHODID_{{methodNameUpperUnderscore}}:
return (io.grpc.stub.StreamObserver) com.salesforce.reactorgrpc.stub.ServerCalls.{{reactiveCallsMethodName}}(
(io.grpc.stub.StreamObserver<{{outputType}}>) responseObserver,
serviceImpl::{{methodName}});
{{/isManyInput}}
{{/methods}}
default:
throw new java.lang.AssertionError();
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy