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 originalConnectionfrom proxyBatch.static Optional<Connection> unwrapConnection(Connection connection) static Optional<Connection> unwrapConnection(Result result) Get originalConnectionfrom proxyResult.static Optional<Connection> unwrapConnection(Statement statement) Get originalConnectionfrom proxyStatement.
-
Method Details
-
unwrapConnection
- Parameters:
connection- a connection- Returns:
- optional of original connection or give connection
- Throws:
IllegalArgumentException- ifconnectionisnull
-
unwrapConnection
Get originalConnectionfrom proxyBatch. When providedBatchis a proxy that implementsConnectionHolder, retrieves originalConnection; otherwise, returns emptyOptional.- Parameters:
batch- a batch- Returns:
- optional of original connection or empty
- Throws:
IllegalArgumentException- ifbatchisnull
-
unwrapConnection
Get originalConnectionfrom proxyStatement. When providedStatementis a proxy that implementsConnectionHolder, retrieves originalConnection; otherwise, returns emptyOptional.- Parameters:
statement- a statement- Returns:
- optional of original connection or empty
- Throws:
IllegalArgumentException- ifstatementisnull
-
unwrapConnection
Get originalConnectionfrom proxyResult. When providedResultis a proxy that implementsConnectionHolder, retrieves originalConnection; otherwise, returns emptyOptional.- Parameters:
result- a statement- Returns:
- optional of original connection or empty
- Throws:
IllegalArgumentException- ifresultisnull
-