public final class ResultCallbackHandler extends Object
Result.| 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 | 
|---|
ResultCallbackHandler(io.r2dbc.spi.Result result,
                     QueryExecutionInfo queryExecutionInfo,
                     ProxyConfig proxyConfig,
                     QueriesExecutionContext queriesExecutionContext)
Callback handler logic for  
Result. | 
| 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 ResultCallbackHandler(io.r2dbc.spi.Result result,
                             QueryExecutionInfo queryExecutionInfo,
                             ProxyConfig proxyConfig,
                             QueriesExecutionContext queriesExecutionContext)
Result.
 This constructor purposely uses QueryExecutionInfo interface for arguments instead of MutableQueryExecutionInfo implementation.
 This way, creator of this callback handler (ProxyFactory) does not depend on MutableQueryExecutionInfo implementation.result - query resultqueryExecutionInfo - query execution infoproxyConfig - proxy configqueriesExecutionContext - queries execution counterIllegalArgumentException - if result is nullIllegalArgumentException - if queryExecutionInfo is nullIllegalArgumentException - if proxyConfig is nullIllegalArgumentException - if queriesExecutionCounter is nullIllegalArgumentException - if queryExecutionInfo is not an instance of MutableQueryExecutionInfopublic Object invoke(Object proxy, Method method, @Nullable Object[] args) throws Throwable
CallbackHandlerproxy - 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 nullprotected 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 nullIllegalArgumentException - if target is nullIllegalArgumentException - if listener is nullprotected 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 nullIllegalArgumentException - if executionInfo is nullpublic 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 nullCallbackHandlerSupport.MethodInvocationStrategyCopyright © 2025. All rights reserved.