public class DefaultSessionFactoryLocator<F> extends Object implements SessionFactoryLocator<F>
SessionFactoryLocator using a simple map lookup
and an optional default to fall back on.| Constructor and Description |
|---|
DefaultSessionFactoryLocator(Map<Object,SessionFactory<F>> factories) |
DefaultSessionFactoryLocator(Map<Object,SessionFactory<F>> factories,
SessionFactory<F> defaultFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSessionFactory(String key,
SessionFactory<F> factory)
Add a session factory.
|
SessionFactory<F> |
getSessionFactory(Object key)
Return a
SessionFactory for the key. |
SessionFactory<F> |
removeSessionFactory(Object key)
Remove a session factory.
|
public DefaultSessionFactoryLocator(Map<Object,SessionFactory<F>> factories)
factories - A map of factories, keyed by lookup key.public DefaultSessionFactoryLocator(Map<Object,SessionFactory<F>> factories, SessionFactory<F> defaultFactory)
factories - A map of factories, keyed by lookup key.defaultFactory - A default to be used if the lookup fails.public void addSessionFactory(String key, SessionFactory<F> factory)
key - the lookup key.factory - the factory.public SessionFactory<F> removeSessionFactory(Object key)
key - the lookup key.public SessionFactory<F> getSessionFactory(Object key)
SessionFactoryLocatorSessionFactory for the key.getSessionFactory in interface SessionFactoryLocator<F>key - the key.