public abstract class ConfigProviderResolver extends Object
This class is not intended to be used by end-users.
The implementation of this class should register itself via the ServiceLoader
mechanism.
Modifier | Constructor and Description |
---|---|
protected |
ConfigProviderResolver()
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
abstract ConfigBuilder |
getBuilder()
Create a
ConfigBuilder instance for the current application. |
abstract Config |
getConfig()
Get the configuration instance for the current application in the manner described by
ConfigProvider.getConfig() . |
abstract Config |
getConfig(ClassLoader loader)
Get the configuration instance for the current application in the manner described by
ConfigProvider.getConfig(ClassLoader) . |
static ConfigProviderResolver |
instance()
Find and return the provider resolver instance.
|
abstract void |
registerConfig(Config config,
ClassLoader classLoader)
Register the given
Config instance to the application identified by the given class loader. |
abstract void |
releaseConfig(Config config)
A
Config normally gets released if the Application it is associated with gets destroyed. |
static void |
setInstance(ConfigProviderResolver resolver)
Set the instance.
|
protected ConfigProviderResolver()
public abstract Config getConfig()
ConfigProvider.getConfig()
.public abstract Config getConfig(ClassLoader loader)
ConfigProvider.getConfig(ClassLoader)
.loader
- the class loader identifying the applicationpublic abstract ConfigBuilder getBuilder()
ConfigBuilder
instance for the current application.
The returned configuration builder must initially contain no registered configuration sources.
The returned configuration builder must initially contain only built in converters.
public abstract void registerConfig(Config config, ClassLoader classLoader)
Config
instance to the application identified by the given class loader. If the class
loader is null
, then the current application (as identified by the
thread context class loader) will be used.config
- the configuration to registerclassLoader
- the class loader identifying the applicationIllegalStateException
- if there is already a configuration registered for the applicationpublic abstract void releaseConfig(Config config)
Config
normally gets released if the Application it is associated with gets destroyed. Invoke this
method if you like to destroy the Config prematurely.
If the given Config is associated within an Application then it will be unregistered.config
- the config to be releasedpublic static ConfigProviderResolver instance()
ServiceLoader
is used to locate the first
implementation that is visible from the class loader that defined this class.public static void setInstance(ConfigProviderResolver resolver)
Note that calling this method after a different provider instance was already retrieved can lead to inconsistent results. Mixing usage of this method with the service loader pattern is for this reason strongly discouraged.
resolver
- the instance to set, or null
to unset the instanceCopyright © 2016 – 2020 Eclipse Foundation. All rights reserved.
Use is subject to license terms.