Package com.yahoo.config.subscription
Class ConfigGetter<T extends com.yahoo.config.ConfigInstance>
java.lang.Object
com.yahoo.config.subscription.ConfigGetter<T>
This is a simple config getter that retrieves a config with a given class and configId through a
simple method call. No subscription is retained when the config has been returned to the client.
This class is mainly targeted to unit tests that do not want the extra complexity incurred by setting
up their own subscriber. Another use-case is clients that get config, do a task, and exit, e.g.
command-line tools.
- Author:
- gjoranv
-
Constructor Summary
ConstructorDescriptionConfigGetter
(ConfigSource source, Class<T> clazz) Deprecated, for removal: This API element is subject to removal in a future version.Config should always be injected via the component class constructor.ConfigGetter
(Class<T> clazz) Creates a ConfigGetter for classclazz
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends com.yahoo.config.ConfigInstance>
TCreates a ConfigGetter instance and returns an instance of the config classc
.static <T extends com.yahoo.config.ConfigInstance>
TgetConfig
(Class<T> c, String configId, ConfigSource source) Deprecated, for removal: This API element is subject to removal in a future version.Config should always be injected via the component class constructor.Returns an instance of the config class specified in the constructor.
-
Constructor Details
-
ConfigGetter
Creates a ConfigGetter for classclazz
- Parameters:
clazz
- a config class
-
ConfigGetter
Deprecated, for removal: This API element is subject to removal in a future version.Config should always be injected via the component class constructor. For unit tests, use config builders.Creates a ConfigGetter for classclazz
with the specifiedConfigSource
.- Parameters:
source
- aConfigSource
clazz
- a config class
-
-
Method Details
-
getConfig
Returns an instance of the config class specified in the constructor.- Parameters:
configId
- a config id to use when getting the config- Returns:
- an instance of a config class
-
getConfig
Creates a ConfigGetter instance and returns an instance of the config classc
.- Parameters:
c
- a config classconfigId
- a config id to use when getting the config- Returns:
- an instance of a config class
-
getConfig
@Deprecated(forRemoval=true, since="7") public static <T extends com.yahoo.config.ConfigInstance> T getConfig(Class<T> c, String configId, ConfigSource source) Deprecated, for removal: This API element is subject to removal in a future version.Config should always be injected via the component class constructor. For unit tests, use config builders.Creates a ConfigGetter instance and returns an instance of the config classc
.- Parameters:
c
- a config classconfigId
- a config id to use when getting the configsource
- aConfigSource
- Returns:
- an instance of a config class
-