public final class StatementCallbackHandler extends Object
Statement
.Modifier and Type | Class and Description |
---|---|
static interface |
CallbackHandlerSupport.MethodInvocationStrategy
Strategy to invoke the original instance(non-proxy) and retrieve result.
|
Modifier and Type | Field and Description |
---|---|
protected static CallbackHandlerSupport.MethodInvocationStrategy |
DEFAULT_INVOCATION_STRATEGY |
protected CallbackHandlerSupport.MethodInvocationStrategy |
methodInvocationStrategy |
protected ProxyConfig |
proxyConfig |
Constructor and Description |
---|
StatementCallbackHandler(io.r2dbc.spi.Statement statement,
StatementInfo statementInfo,
ConnectionInfo connectionInfo,
ProxyConfig proxyConfig) |
Modifier and Type | Method and Description |
---|---|
protected Object |
handleCommonMethod(String methodName,
Object original,
Object[] args,
io.r2dbc.spi.Connection originalConnection) |
protected Flux<? extends io.r2dbc.spi.Result> |
interceptQueryExecution(Publisher<? extends io.r2dbc.spi.Result> publisher,
io.r2dbc.proxy.callback.MutableQueryExecutionInfo executionInfo)
Augment query execution result to hook up listener lifecycle.
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
When proxy is invoked, actual implementation of the proxy handler delegates the
invocation to this method.
|
protected boolean |
isCommonMethod(String methodName) |
protected Object |
proceedExecution(Method method,
Object target,
Object[] args,
ProxyExecutionListener listener,
ConnectionInfo connectionInfo,
Consumer<MethodExecutionInfo> onComplete)
Augment method invocation and call method listener.
|
void |
setMethodInvocationStrategy(CallbackHandlerSupport.MethodInvocationStrategy methodInvocationStrategy)
Set
CallbackHandlerSupport.MethodInvocationStrategy to invoke the original instance(non-proxy) and retrieve result. |
protected static final CallbackHandlerSupport.MethodInvocationStrategy DEFAULT_INVOCATION_STRATEGY
protected final ProxyConfig proxyConfig
protected CallbackHandlerSupport.MethodInvocationStrategy methodInvocationStrategy
public StatementCallbackHandler(io.r2dbc.spi.Statement statement, StatementInfo statementInfo, ConnectionInfo connectionInfo, ProxyConfig proxyConfig)
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
CallbackHandler
proxy
- the proxy instance that the method was invoked onmethod
- the method that has invoked on the proxy instanceargs
- an array of objects that has passed to the method invocation.
this can be null
when method is invoked with no argument.null
.)Throwable
- the exception thrown from the method invocation on the proxy instance.IllegalArgumentException
- if proxy
is null
protected boolean isCommonMethod(String methodName)
@Nullable protected Object handleCommonMethod(String methodName, Object original, @Nullable Object[] args, @Nullable io.r2dbc.spi.Connection originalConnection)
protected Object proceedExecution(Method method, Object target, @Nullable Object[] args, ProxyExecutionListener listener, @Nullable ConnectionInfo connectionInfo, @Nullable Consumer<MethodExecutionInfo> onComplete) throws Throwable
method
- method to invoke on targettarget
- an object being invokedargs
- arguments for the method. null
if the method doesn't take any arguments.listener
- listener that before/after method callbacks will be calledconnectionInfo
- current connection information. null
when invoked operation is not associated to the Connection
.onComplete
- a callback that will be invoked at successful termination(onComplete) of the result publisher.Throwable
- thrown exception during the invocationIllegalArgumentException
- if method
is null
IllegalArgumentException
- if target
is null
IllegalArgumentException
- if listener
is null
protected Flux<? extends io.r2dbc.spi.Result> interceptQueryExecution(Publisher<? extends io.r2dbc.spi.Result> publisher, io.r2dbc.proxy.callback.MutableQueryExecutionInfo executionInfo)
publisher
- query invocation result publisherexecutionInfo
- query execution context infoIllegalArgumentException
- if flux
is null
IllegalArgumentException
- if executionInfo
is null
public void setMethodInvocationStrategy(CallbackHandlerSupport.MethodInvocationStrategy methodInvocationStrategy)
CallbackHandlerSupport.MethodInvocationStrategy
to invoke the original instance(non-proxy) and retrieve result.methodInvocationStrategy
- strategy for method invocationIllegalArgumentException
- if methodInvocationStrategy
is null
CallbackHandlerSupport.MethodInvocationStrategy
Copyright © 2024. All rights reserved.