Created
February 4, 2019 22:54
-
-
Save ttddyy/e1bf41fcd8d8fdf88d90f7ca8cd503ab to your computer and use it in GitHub Desktop.
Wrap result of ConnectionFactory#create()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pointcut { | |
// pointcut for ConnectionFactory#create() method | |
public Publisher<? extends Connection> pointcut() { | |
Publisher<? extends Connection> result = null; // actual result of "ConnectionFactory#create()" | |
ProxyFactory proxyFactory = null; // need to construct | |
// return wrapped one | |
return Flux.from(result) | |
.flatMap(origiinalConn -> { | |
ConnectionInfo connectionInfo = null; // need to construct it | |
Connection wrappedConn = proxyFactory.wrapConnection(origiinalConn, connectionInfo); | |
return Mono.just(wrappedConn); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment