Package org.springframework.boot.jdbc
Class DataSourceUnwrapper
java.lang.Object
org.springframework.boot.jdbc.DataSourceUnwrapper
Unwraps a
DataSource that may have been proxied or wrapped in a custom
Wrapper such as DelegatingDataSource.- Since:
- 2.0.7
- Author:
- Tadaya Tsuyukubo, Stephane Nicoll
-
Method Summary
Modifier and TypeMethodDescriptionstatic <I,T extends I>
Tunwrap(DataSource dataSource, Class<I> unwrapInterface, Class<T> target) Return an object that implements the giventargettype, unwrapping delegate or proxy if necessary using the specifiedunwrapInterface.static <T> Tunwrap(DataSource dataSource, Class<T> target) Return an object that implements the giventargettype, unwrapping delegate or proxy if necessary.
-
Method Details
-
unwrap
public static <I,T extends I> T unwrap(DataSource dataSource, Class<I> unwrapInterface, Class<T> target) Return an object that implements the giventargettype, unwrapping delegate or proxy if necessary using the specifiedunwrapInterface.- Type Parameters:
I- the interface that the target type must implementT- the target type- Parameters:
dataSource- the datasource to handleunwrapInterface- the interface that the target type must implementtarget- the type that the result must implement- Returns:
- an object that implements the target type or
null - Since:
- 2.3.8
- See Also:
-
unwrap
Return an object that implements the giventargettype, unwrapping delegate or proxy if necessary. Consider usingunwrap(DataSource, Class, Class)asunwrappingwon't be considered iftargetis not an interface.- Type Parameters:
T- the target type- Parameters:
dataSource- the datasource to handletarget- the type that the result must implement- Returns:
- an object that implements the target type or
null
-