public abstract class ConfigProviderResolver
extends java.lang.Object
ServiceLoader
mechanism.Modifier | Constructor and Description |
---|---|
protected |
ConfigProviderResolver() |
Modifier and Type | Method and Description |
---|---|
abstract ConfigBuilder |
getBuilder()
Create a fresh
ConfigBuilder instance. |
abstract Config |
getConfig() |
abstract Config |
getConfig(java.lang.ClassLoader loader) |
static ConfigProviderResolver |
instance()
Creates a ConfigProviderResolver object
Only used internally from within
ConfigProvider |
abstract void |
registerConfig(Config config,
java.lang.ClassLoader classLoader)
Register a given
Config within the Application (or Module) identified by the given ClassLoader. |
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.
|
public abstract Config getConfig()
ConfigProvider.getConfig()
public abstract Config getConfig(java.lang.ClassLoader loader)
loader
- the classloaderConfigProvider.getConfig(ClassLoader)
public abstract ConfigBuilder getBuilder()
ConfigBuilder
instance.
This ConfigBuilder will initially contain no ConfigSource
. The other ConfigSource
will have
to be added manually or discovered by calling ConfigBuilder.addDiscoveredSources()
.
This ConfigBuilder will initially contain default Converters
. Any other converters will need to
be added manually.
The ConfigProvider will not manage the Config instance internallypublic abstract void registerConfig(Config config, java.lang.ClassLoader classLoader)
Config
within the Application (or Module) identified by the given ClassLoader.
If the ClassLoader is null
then the current Application will be used.config
- which should get registeredclassLoader
- which identifies the Application or Module the given Config should get associated with.java.lang.IllegalStateException
- if there is already a Config registered within the Application.
A user could explicitly use releaseConfig(Config)
for this case.public 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()
ConfigProvider
public static void setInstance(ConfigProviderResolver resolver)
resolver
- set the instance.