public class MapConnectionFactoryLookup extends Object implements ConnectionFactoryLookup
ConnectionFactoryLookup
implementation that relies
on a map for doing lookups.
Useful for testing environments or applications that need to match
arbitrary String
names to target ConnectionFactory
objects.
Constructor and Description |
---|
MapConnectionFactoryLookup()
Create a new instance of the
MapConnectionFactoryLookup class. |
MapConnectionFactoryLookup(Map<String,io.r2dbc.spi.ConnectionFactory> connectionFactories)
Create a new instance of the
MapConnectionFactoryLookup class. |
MapConnectionFactoryLookup(String connectionFactoryName,
io.r2dbc.spi.ConnectionFactory connectionFactory)
Create a new instance of the
MapConnectionFactoryLookup class. |
Modifier and Type | Method and Description |
---|---|
void |
addConnectionFactory(String connectionFactoryName,
io.r2dbc.spi.ConnectionFactory connectionFactory)
Add the supplied
ConnectionFactory to the map of
ConnectionFactory instances maintained by this object. |
Map<String,io.r2dbc.spi.ConnectionFactory> |
getConnectionFactories()
Get the
Map of ConnectionFactories maintained by this object. |
io.r2dbc.spi.ConnectionFactory |
getConnectionFactory(String connectionFactoryName)
Retrieve the
ConnectionFactory identified by the given name. |
void |
setConnectionFactories(Map<String,io.r2dbc.spi.ConnectionFactory> connectionFactories)
Set the
Map of ConnectionFactories . |
public MapConnectionFactoryLookup()
MapConnectionFactoryLookup
class.public MapConnectionFactoryLookup(Map<String,io.r2dbc.spi.ConnectionFactory> connectionFactories)
MapConnectionFactoryLookup
class.public MapConnectionFactoryLookup(String connectionFactoryName, io.r2dbc.spi.ConnectionFactory connectionFactory)
MapConnectionFactoryLookup
class.connectionFactoryName
- the name under which the supplied ConnectionFactory
is to be addedconnectionFactory
- the ConnectionFactory
to be addedpublic void setConnectionFactories(Map<String,io.r2dbc.spi.ConnectionFactory> connectionFactories)
Map
of ConnectionFactories
.
The keys are Strings
, the values are actual ConnectionFactory
instances.
If the supplied Map
is null
, then this method call effectively has no effect.
connectionFactories
- said Map
of connectionFactories
public Map<String,io.r2dbc.spi.ConnectionFactory> getConnectionFactories()
Map
of connectionFactory
(never null
)public void addConnectionFactory(String connectionFactoryName, io.r2dbc.spi.ConnectionFactory connectionFactory)
ConnectionFactory
to the map of
ConnectionFactory
instances maintained by this object.connectionFactoryName
- the name under which the supplied ConnectionFactory
is to be addedconnectionFactory
- the ConnectionFactory
to be so addedpublic io.r2dbc.spi.ConnectionFactory getConnectionFactory(String connectionFactoryName) throws ConnectionFactoryLookupFailureException
ConnectionFactoryLookup
ConnectionFactory
identified by the given name.getConnectionFactory
in interface ConnectionFactoryLookup
connectionFactoryName
- the name of the ConnectionFactory
ConnectionFactory
(never null
)ConnectionFactoryLookupFailureException
- if the lookup failed