public final class UnaryMethodStubBuilderImpl<ReqT,RespT> extends Object implements UnaryMethodStubBuilderStep<ReqT,RespT>, NextUnaryMethodResponseBuilderStep<ReqT,RespT>
| Constructor and Description |
|---|
UnaryMethodStubBuilderImpl(io.grpc.MethodDescriptor<ReqT,RespT> method) |
| Modifier and Type | Method and Description |
|---|---|
MethodStub<ReqT,RespT> |
build() |
NextUnaryMethodResponseBuilderStep<ReqT,RespT> |
nextWillProxyTo(BiConsumer<ReqT,io.grpc.stub.StreamObserver<RespT>> responseProxy)
Defines a proxying response, which will proxy the request to given
Response for
subsequent request call to this stub. |
NextUnaryMethodResponseBuilderStep<ReqT,RespT> |
nextWillReturn(ExceptionResponseActionBuilder response)
Defines a exception
Response for subsequent request call to this stub. |
NextUnaryMethodResponseBuilderStep<ReqT,RespT> |
nextWillReturn(ObjectResponseActionBuilder<RespT> response)
Defines a single
Response for subsequent request call to this stub. |
NextUnaryMethodResponseBuilderStep<ReqT,RespT> |
willProxyTo(BiConsumer<ReqT,io.grpc.stub.StreamObserver<RespT>> responseProxy)
Defines a proxying response, which will proxy the request to given
Response. |
NextUnaryMethodResponseBuilderStep<ReqT,RespT> |
willReturn(ExceptionResponseActionBuilder response)
Defines a exception
Response that will terminate the request. |
NextUnaryMethodResponseBuilderStep<ReqT,RespT> |
willReturn(ObjectResponseActionBuilder<RespT> response)
Defines a single
Response that will be returned for the request and complete it. |
<T> UnaryMethodStubBuilderStep<ReqT,RespT> |
withHeader(io.grpc.Metadata.Key<T> headerKey,
Predicate<T> predicate)
Adds a header matcher for the stub, which will trigger only if the given header
has value satisfying given
Predicate. |
UnaryMethodStubBuilderStep<ReqT,RespT> |
withRequest(Predicate<ReqT> requestPredicate)
Adds a request matcher for the stub, which will trigger only if incoming request
satisfies given
Predicate. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwithHeader, withHeader, withHeader, withHeader, withoutHeader, withoutHeaderwithRequestwillReturn, willReturnwillReturnnextWillReturn, nextWillReturnnextWillReturnpublic <T> UnaryMethodStubBuilderStep<ReqT,RespT> withHeader(@Nonnull io.grpc.Metadata.Key<T> headerKey, @Nonnull Predicate<T> predicate)
HeadersMatcherBuilderStepAdds a header matcher for the stub, which will trigger only if the given header
has value satisfying given Predicate.
Subsequent matchers for the same header will replace the old one.
withHeader in interface HeadersMatcherBuilderStep<UnaryMethodStubBuilderStep<ReqT,RespT>>public UnaryMethodStubBuilderStep<ReqT,RespT> withRequest(@Nonnull Predicate<ReqT> requestPredicate)
RequestMatcherBuilderStepAdds a request matcher for the stub, which will trigger only if incoming request
satisfies given Predicate.
Only applicable to unary or server streaming methods.
Subsequent request matchers will replace the old one.
withRequest in interface RequestMatcherBuilderStep<UnaryMethodStubBuilderStep<ReqT,RespT>,ReqT>public NextUnaryMethodResponseBuilderStep<ReqT,RespT> willReturn(@Nonnull ObjectResponseActionBuilder<RespT> response)
SingleResponseBuilderStepResponse that will be returned for the request and complete it.willReturn in interface SingleResponseBuilderStep<NextUnaryMethodResponseBuilderStep<ReqT,RespT>,RespT>public NextUnaryMethodResponseBuilderStep<ReqT,RespT> willReturn(@Nonnull ExceptionResponseActionBuilder response)
SingleResponseBuilderStepResponse that will terminate the request.willReturn in interface SingleResponseBuilderStep<NextUnaryMethodResponseBuilderStep<ReqT,RespT>,RespT>public NextUnaryMethodResponseBuilderStep<ReqT,RespT> nextWillReturn(@Nonnull ObjectResponseActionBuilder<RespT> response)
NextSingleResponseBuilderStepDefines a single Response for subsequent request call to this stub.
If there are more requests coming in to this stub than responses defined, the last response defined will be returned for those requests.
nextWillReturn in interface NextSingleResponseBuilderStep<NextUnaryMethodResponseBuilderStep<ReqT,RespT>,ReqT,RespT>public NextUnaryMethodResponseBuilderStep<ReqT,RespT> nextWillReturn(@Nonnull ExceptionResponseActionBuilder response)
NextSingleResponseBuilderStepDefines a exception Response for subsequent request call to this stub.
If there are more requests coming in to this stub than responses defined, the last response defined will be returned for those requests.
nextWillReturn in interface NextSingleResponseBuilderStep<NextUnaryMethodResponseBuilderStep<ReqT,RespT>,ReqT,RespT>public NextUnaryMethodResponseBuilderStep<ReqT,RespT> willProxyTo(@Nonnull BiConsumer<ReqT,io.grpc.stub.StreamObserver<RespT>> responseProxy)
SingleRequestProxyResponseBuilderStepDefines a proxying response, which will proxy the request to given Response. The
user is responsible that the request is completed correctly.
Should be used when there needs to be more logic in the response method than returning a
simple response.
For example:
.willProxyTo((request, responseObserver) -> {
responseObserver.onNext(responseObject);
responseObserver.onCompleted();
});
willProxyTo in interface SingleRequestProxyResponseBuilderStep<NextUnaryMethodResponseBuilderStep<ReqT,RespT>,ReqT,RespT>public NextUnaryMethodResponseBuilderStep<ReqT,RespT> nextWillProxyTo(@Nonnull BiConsumer<ReqT,io.grpc.stub.StreamObserver<RespT>> responseProxy)
NextSingleRequestProxyResponseBuilderStepDefines a proxying response, which will proxy the request to given Response for
subsequent request call to this stub. The user is responsible that the request is completed correctly.
Should be used when there needs to be more logic in the response method than returning a
simple response.
For example:
.nextWillProxyTo((request, responseObserver) -> {
responseObserver.onNext(responseObject);
responseObserver.onCompleted();
});
nextWillProxyTo in interface NextSingleRequestProxyResponseBuilderStep<NextUnaryMethodResponseBuilderStep<ReqT,RespT>,ReqT,RespT>public MethodStub<ReqT,RespT> build()
build in interface MethodStubBuilder<ReqT,RespT>Copyright © 2023. All rights reserved.