Class ProxyUtils
java.lang.Object
io.r2dbc.proxy.callback.ProxyUtils
Utility methods to obtain original
Connection
from proxy class.- Author:
- Tadaya Tsuyukubo
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional
<Connection> unwrapConnection
(Batch batch) Get originalConnection
from proxyBatch
.static Optional
<Connection> unwrapConnection
(Connection connection) static Optional
<Connection> unwrapConnection
(Result result) Get originalConnection
from proxyResult
.static Optional
<Connection> unwrapConnection
(Statement statement) Get originalConnection
from proxyStatement
.
-
Method Details
-
unwrapConnection
- Parameters:
connection
- a connection- Returns:
- optional of original connection or give connection
- Throws:
IllegalArgumentException
- ifconnection
isnull
-
unwrapConnection
Get originalConnection
from proxyBatch
. When providedBatch
is a proxy that implementsConnectionHolder
, retrieves originalConnection
; otherwise, returns emptyOptional
.- Parameters:
batch
- a batch- Returns:
- optional of original connection or empty
- Throws:
IllegalArgumentException
- ifbatch
isnull
-
unwrapConnection
Get originalConnection
from proxyStatement
. When providedStatement
is a proxy that implementsConnectionHolder
, retrieves originalConnection
; otherwise, returns emptyOptional
.- Parameters:
statement
- a statement- Returns:
- optional of original connection or empty
- Throws:
IllegalArgumentException
- ifstatement
isnull
-
unwrapConnection
Get originalConnection
from proxyResult
. When providedResult
is a proxy that implementsConnectionHolder
, retrieves originalConnection
; otherwise, returns emptyOptional
.- Parameters:
result
- a statement- Returns:
- optional of original connection or empty
- Throws:
IllegalArgumentException
- ifresult
isnull
-