Package io.grpc
Class ClientInterceptors
- java.lang.Object
-
- io.grpc.ClientInterceptors
-
public class ClientInterceptors extends java.lang.ObjectUtility methods for working withClientInterceptors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClientInterceptors.CheckedForwardingClientCall<ReqT,RespT>AForwardingClientCallthat delivers exceptions from its start logic to the call listener.private static classClientInterceptors.InterceptorChannel
-
Field Summary
Fields Modifier and Type Field Description private static ClientCall<java.lang.Object,java.lang.Object>NOOP_CALL
-
Constructor Summary
Constructors Modifier Constructor Description privateClientInterceptors()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Channelintercept(Channel channel, ClientInterceptor... interceptors)Create a newChannelthat will callinterceptorsbefore starting a call on the given channel.static Channelintercept(Channel channel, java.util.List<? extends ClientInterceptor> interceptors)Create a newChannelthat will callinterceptorsbefore starting a call on the given channel.static ChannelinterceptForward(Channel channel, ClientInterceptor... interceptors)Create a newChannelthat will callinterceptorsbefore starting a call on the given channel.static ChannelinterceptForward(Channel channel, java.util.List<? extends ClientInterceptor> interceptors)Create a newChannelthat will callinterceptorsbefore starting a call on the given channel.(package private) static <WReqT,WRespT>
ClientInterceptorwrapClientInterceptor(ClientInterceptor interceptor, MethodDescriptor.Marshaller<WReqT> reqMarshaller, MethodDescriptor.Marshaller<WRespT> respMarshaller)Creates a new ClientInterceptor that transforms requests intoWReqTand responses intoWRespTbefore passing them into theinterceptor.
-
-
-
Field Detail
-
NOOP_CALL
private static final ClientCall<java.lang.Object,java.lang.Object> NOOP_CALL
-
-
Method Detail
-
interceptForward
public static Channel interceptForward(Channel channel, ClientInterceptor... interceptors)
Create a newChannelthat will callinterceptorsbefore starting a call on the given channel. The first interceptor will have itsClientInterceptor.interceptCall(io.grpc.MethodDescriptor<ReqT, RespT>, io.grpc.CallOptions, io.grpc.Channel)called first.- Parameters:
channel- the underlying channel to intercept.interceptors- array of interceptors to bind tochannel.- Returns:
- a new channel instance with the interceptors applied.
-
interceptForward
public static Channel interceptForward(Channel channel, java.util.List<? extends ClientInterceptor> interceptors)
Create a newChannelthat will callinterceptorsbefore starting a call on the given channel. The first interceptor will have itsClientInterceptor.interceptCall(io.grpc.MethodDescriptor<ReqT, RespT>, io.grpc.CallOptions, io.grpc.Channel)called first.- Parameters:
channel- the underlying channel to intercept.interceptors- a list of interceptors to bind tochannel.- Returns:
- a new channel instance with the interceptors applied.
-
intercept
public static Channel intercept(Channel channel, ClientInterceptor... interceptors)
Create a newChannelthat will callinterceptorsbefore starting a call on the given channel. The last interceptor will have itsClientInterceptor.interceptCall(io.grpc.MethodDescriptor<ReqT, RespT>, io.grpc.CallOptions, io.grpc.Channel)called first.- Parameters:
channel- the underlying channel to intercept.interceptors- array of interceptors to bind tochannel.- Returns:
- a new channel instance with the interceptors applied.
-
intercept
public static Channel intercept(Channel channel, java.util.List<? extends ClientInterceptor> interceptors)
Create a newChannelthat will callinterceptorsbefore starting a call on the given channel. The last interceptor will have itsClientInterceptor.interceptCall(io.grpc.MethodDescriptor<ReqT, RespT>, io.grpc.CallOptions, io.grpc.Channel)called first.- Parameters:
channel- the underlying channel to intercept.interceptors- a list of interceptors to bind tochannel.- Returns:
- a new channel instance with the interceptors applied.
-
wrapClientInterceptor
static <WReqT,WRespT> ClientInterceptor wrapClientInterceptor(ClientInterceptor interceptor, MethodDescriptor.Marshaller<WReqT> reqMarshaller, MethodDescriptor.Marshaller<WRespT> respMarshaller)
Creates a new ClientInterceptor that transforms requests intoWReqTand responses intoWRespTbefore passing them into theinterceptor.
-
-