Class RowCallbackHandler
java.lang.Object
io.r2dbc.proxy.callback.RowCallbackHandler
- All Implemented Interfaces:
CallbackHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final io.r2dbc.proxy.callback.CallbackHandlerSupport.MethodInvocationStrategyprotected io.r2dbc.proxy.callback.CallbackHandlerSupport.MethodInvocationStrategyprotected final ProxyConfig -
Constructor Summary
ConstructorsConstructorDescriptionRowCallbackHandler(Row row, QueryExecutionInfo queryExecutionInfo, ProxyConfig proxyConfig) Callback handler logic forRow. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjecthandleCommonMethod(String methodName, Object original, Object[] args, Connection originalConnection) interceptQueryExecution(Publisher<? extends Result> publisher, io.r2dbc.proxy.callback.MutableQueryExecutionInfo executionInfo) Augment query execution result to hook up listener lifecycle.When proxy is invoked, actual implementation of the proxy handler delegates the invocation to this method.protected booleanisCommonMethod(String methodName) protected ObjectproceedExecution(Method method, Object target, Object[] args, ProxyExecutionListener listener, ConnectionInfo connectionInfo, Consumer<MethodExecutionInfo> onComplete) Augment method invocation and call method listener.voidsetMethodInvocationStrategy(io.r2dbc.proxy.callback.CallbackHandlerSupport.MethodInvocationStrategy methodInvocationStrategy) SetCallbackHandlerSupport.MethodInvocationStrategyto invoke the original instance(non-proxy) and retrieve result.
-
Field Details
-
DEFAULT_INVOCATION_STRATEGY
protected static final io.r2dbc.proxy.callback.CallbackHandlerSupport.MethodInvocationStrategy DEFAULT_INVOCATION_STRATEGY -
proxyConfig
-
methodInvocationStrategy
protected io.r2dbc.proxy.callback.CallbackHandlerSupport.MethodInvocationStrategy methodInvocationStrategy
-
-
Constructor Details
-
RowCallbackHandler
Callback handler logic forRow.- Parameters:
row- rowqueryExecutionInfo- query execution infoproxyConfig- proxy config- Throws:
IllegalArgumentException- ifrowisnullIllegalArgumentException- ifqueryExecutionInfoisnullIllegalArgumentException- ifproxyConfigisnull
-
-
Method Details
-
invoke
Description copied from interface:CallbackHandlerWhen proxy is invoked, actual implementation of the proxy handler delegates the invocation to this method.- Parameters:
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 benullwhen method is invoked with no argument.- Returns:
- result returned from the method invocation on the proxy instance. (can be
null.) - Throws:
Throwable- the exception thrown from the method invocation on the proxy instance.
-
isCommonMethod
-
handleCommonMethod
-
proceedExecution
protected Object proceedExecution(Method method, Object target, @Nullable Object[] args, ProxyExecutionListener listener, @Nullable ConnectionInfo connectionInfo, @Nullable Consumer<MethodExecutionInfo> onComplete) throws Throwable Augment method invocation and call method listener.- Parameters:
method- method to invoke on targettarget- an object being invokedargs- arguments for the method.nullif the method doesn't take any arguments.listener- listener that before/after method callbacks will be calledconnectionInfo- current connection information.nullwhen invoked operation is not associated to theConnection.onComplete- a callback that will be invoked at successful termination(onComplete) of the result publisher.- Returns:
- result of invoking the original object
- Throws:
Throwable- thrown exception during the invocationIllegalArgumentException- ifmethodisnullIllegalArgumentException- iftargetisnullIllegalArgumentException- iflistenerisnull
-
interceptQueryExecution
protected Flux<? extends Result> interceptQueryExecution(Publisher<? extends Result> publisher, io.r2dbc.proxy.callback.MutableQueryExecutionInfo executionInfo) Augment query execution result to hook up listener lifecycle.- Parameters:
publisher- query invocation result publisherexecutionInfo- query execution context info- Returns:
- query invocation result flux
- Throws:
IllegalArgumentException- iffluxisnullIllegalArgumentException- ifexecutionInfoisnull
-
setMethodInvocationStrategy
public void setMethodInvocationStrategy(io.r2dbc.proxy.callback.CallbackHandlerSupport.MethodInvocationStrategy methodInvocationStrategy) SetCallbackHandlerSupport.MethodInvocationStrategyto invoke the original instance(non-proxy) and retrieve result.- Parameters:
methodInvocationStrategy- strategy for method invocation- Throws:
IllegalArgumentException- ifmethodInvocationStrategyisnull- See Also:
-