Class ConfigProviderResolver
- java.lang.Object
-
- org.eclipse.microprofile.config.spi.ConfigProviderResolver
-
public abstract class ConfigProviderResolver extends java.lang.Object
This class is not intended to be used by end-users but for portable container integration purpose only. Service provider for ConfigProviderResolver. The implementation registers itself via theServiceLoader
mechanism.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ConfigProviderResolver()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ConfigBuilder
getBuilder()
Create a freshConfigBuilder
instance.abstract Config
getConfig()
abstract Config
getConfig(java.lang.ClassLoader loader)
static ConfigProviderResolver
instance()
Creates a ConfigProviderResolver object Only used internally from withinConfigProvider
abstract void
registerConfig(Config config, java.lang.ClassLoader classLoader)
Register a givenConfig
within the Application (or Module) identified by the given ClassLoader.abstract void
releaseConfig(Config config)
AConfig
normally gets released if the Application it is associated with gets destroyed.static void
setInstance(ConfigProviderResolver resolver)
Set the instance.
-
-
-
Method Detail
-
getConfig
public abstract Config getConfig()
- Returns:
- config the config object for the Thread Context Classloader
- See Also:
ConfigProvider.getConfig()
-
getConfig
public abstract Config getConfig(java.lang.ClassLoader loader)
- Parameters:
loader
- the classloader- Returns:
- config the config object for the specified classloader
- See Also:
ConfigProvider.getConfig(ClassLoader)
-
getBuilder
public abstract ConfigBuilder getBuilder()
Create a freshConfigBuilder
instance. This ConfigBuilder will initially contain noConfigSource
. The otherConfigSource
will have to be added manually or discovered by callingConfigBuilder.addDiscoveredSources()
. This ConfigBuilder will initially contain defaultConverters
. Any other converters will need to be added manually. The ConfigProvider will not manage the Config instance internally- Returns:
- a fresh ConfigBuilder
-
registerConfig
public abstract void registerConfig(Config config, java.lang.ClassLoader classLoader)
Register a givenConfig
within the Application (or Module) identified by the given ClassLoader. If the ClassLoader isnull
then the current Application will be used.- Parameters:
config
- which should get registeredclassLoader
- which identifies the Application or Module the given Config should get associated with.- Throws:
java.lang.IllegalStateException
- if there is already a Config registered within the Application. A user could explicitly usereleaseConfig(Config)
for this case.
-
releaseConfig
public abstract void releaseConfig(Config config)
AConfig
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.- Parameters:
config
- the config to be released
-
instance
public static ConfigProviderResolver instance()
Creates a ConfigProviderResolver object Only used internally from withinConfigProvider
- Returns:
- ConfigProviderResolver an instance of ConfigProviderResolver
-
setInstance
public static void setInstance(ConfigProviderResolver resolver)
Set the instance. It is used by OSGi environment while service loader pattern is not supported.- Parameters:
resolver
- set the instance.
-
-