@ParametersAreNonnullByDefault public final class BackendFactoryRegistry extends Object
URI
schemes with their associated BackendFactory
.
This BackendFactoryRegistry
is used for dynamically create Store
and Backend
when loading and saving a PersistentResource
. For this reason, a BackendFactory
must be registered
before using these operations, with the register(String, BackendFactory)
method.
Resource.load(Map)
,
Resource.save(Map)
Modifier and Type | Method and Description |
---|---|
BackendFactory |
getFactoryFor(String scheme)
Returns the
BackendFactory identified by the given URI scheme . |
static BackendFactoryRegistry |
getInstance()
Returns the instance of this class.
|
boolean |
isRegistered(String scheme)
Checks that a
BackendFactory is registered for the given URI scheme . |
void |
register(String scheme,
BackendFactory factory)
Registers a
BackendFactory identified by the given URI scheme . |
void |
unregister(String scheme)
Unregisters a
BackendFactory identified by the specified URI scheme . |
@Nonnull public static BackendFactoryRegistry getInstance()
@Nonnull public BackendFactory getFactoryFor(String scheme)
BackendFactory
identified by the given URI scheme
.scheme
- the URI scheme identifying the factoryIllegalArgumentException
- if scheme
is null
, or if no factory is registered for the scheme
public boolean isRegistered(@Nullable String scheme)
BackendFactory
is registered for the given URI scheme
.scheme
- the URI scheme identifying the factorytrue
if a factory is registered for the scheme
public void register(String scheme, BackendFactory factory)
BackendFactory
identified by the given URI scheme
.
If the URI scheme
is already registered, its value will be overridden by the factory
.
scheme
- the URI scheme identifying the factoryfactory
- the factoryNullPointerException
- if any argument is null
public void unregister(String scheme)
BackendFactory
identified by the specified URI scheme
.scheme
- the URI scheme identifying the factoryNullPointerException
- if any argument is null
Copyright © 2013–2019 Atlanmod. All rights reserved.