public class ConnectionFactoryRegistry extends Object implements ConnectionFactoryLocator
service provider connection factories
.
Implements ConnectionFactoryLocator
for locating registered factory instances.
Call addConnectionFactory(ConnectionFactory)
to add to this registry.Constructor and Description |
---|
ConnectionFactoryRegistry() |
Modifier and Type | Method and Description |
---|---|
void |
addConnectionFactory(ConnectionFactory<?> connectionFactory)
Add a
ConnectionFactory to this registry. |
<A> ConnectionFactory<A> |
getConnectionFactory(Class<A> apiType)
Lookup a ConnectionFactory by apiType; for example, FacebookApi.class.
|
ConnectionFactory<?> |
getConnectionFactory(String providerId)
Lookup a ConnectionFactory by providerId; for example, "facebook".
|
Set<String> |
registeredProviderIds()
Returns the set of providerIds for which a
ConnectionFactory is registered; for example, { "twitter", "facebook", "foursquare" }
Elements in this set can be passed to ConnectionFactoryLocator.getConnectionFactory(String) to fetch a specific factory instance. |
void |
setConnectionFactories(List<ConnectionFactory<?>> connectionFactories)
Set the group of service provider connection factories registered in this registry.
|
public void addConnectionFactory(ConnectionFactory<?> connectionFactory)
ConnectionFactory
to this registry.connectionFactory
- the connection factorypublic void setConnectionFactories(List<ConnectionFactory<?>> connectionFactories)
addConnectionFactory(ConnectionFactory)
.connectionFactories
- the set of connection factories to registerpublic ConnectionFactory<?> getConnectionFactory(String providerId)
ConnectionFactoryLocator
getConnectionFactory
in interface ConnectionFactoryLocator
providerId
- the provider ID used to look up the ConnectionFactory.public <A> ConnectionFactory<A> getConnectionFactory(Class<A> apiType)
ConnectionFactoryLocator
getConnectionFactory
in interface ConnectionFactoryLocator
A
- the API binding typeapiType
- the Java type of the API binding used to lookup a matching ConnectionFactoryConnectionRepository.getPrimaryConnection(Class)
public Set<String> registeredProviderIds()
ConnectionFactoryLocator
ConnectionFactory
is registered; for example, { "twitter", "facebook", "foursquare" }
Elements in this set can be passed to ConnectionFactoryLocator.getConnectionFactory(String)
to fetch a specific factory instance.registeredProviderIds
in interface ConnectionFactoryLocator