Class MpConfigProviderResolver.ConfigDelegate
- java.lang.Object
-
- io.helidon.config.mp.MpConfigProviderResolver.ConfigDelegate
-
- Enclosing class:
- MpConfigProviderResolver
@Deprecated(since="2.3.1") public static final class MpConfigProviderResolver.ConfigDelegate extends Object implements Config, Config
Deprecated.This is an internal class that was exposed accidentally. It will be package local in next major release.A delegate used to allow replacing configuration at runtime for components that hold a reference to configuration obtained at build time.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.helidon.config.Config
Config.Builder, Config.Context, Config.Key, Config.Type
-
-
Field Summary
-
Fields inherited from interface io.helidon.config.Config
GENERIC_TYPE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> ConfigValue<T>
as(GenericType<T> genericType)
Deprecated.Typed value as aConfigValue
for a generic type.<T> ConfigValue<T>
as(Class<T> type)
Deprecated.Typed value as aConfigValue
.<T> ConfigValue<T>
as(Function<Config,T> mapper)
Deprecated.Typed value as aConfigValue
created from factory method.<T> ConfigValue<List<T>>
asList(Class<T> type)
Deprecated.Returns list of specified type.<T> ConfigValue<List<T>>
asList(Function<Config,T> mapper)
Deprecated.Returns this node as a list converting each list value using the provided mapper.ConfigValue<Map<String,String>>
asMap()
Deprecated.Transform all leaf nodes (values) into Map instance.ConfigValue<List<Config>>
asNodeList()
Deprecated.Returns a list of childConfig
nodes if the node isConfig.Type.OBJECT
.<T> T
convert(Class<T> type, String value)
Deprecated.Convert a String to a specific type.Config
delegate()
Deprecated.Get the underlying instance of this delegate pattern.Config
detach()
Deprecated.Returns a copy of theConfig
node with no parent.Config
get(Config.Key key)
Deprecated.Returns the single sub-node for the specified sub-key.Iterable<ConfigSource>
getConfigSources()
Deprecated.<T> Optional<T>
getOptionalValue(String propertyName, Class<T> propertyType)
Deprecated.Iterable<String>
getPropertyNames()
Deprecated.<T> T
getValue(String propertyName, Class<T> propertyType)
Deprecated.boolean
hasValue()
Deprecated.Returnstrue
if this configuration node has a direct value.Config.Key
key()
Deprecated.Returns the fully-qualified key of theConfig
node.ConfigMapper
mapper()
Deprecated.The mapper used by this config instance.Instant
timestamp()
Deprecated.Returns when the configuration tree was created.Stream<Config>
traverse(Predicate<Config> predicate)
Deprecated.Iterative deepening depth-first traversal of the node and its subtree as aStream<Config>
, qualified by the specified predicate.Config.Type
type()
Deprecated.Provides theConfig.Type
of theConfig
node.
-
-
-
Method Detail
-
timestamp
public Instant timestamp()
Deprecated.Description copied from interface:Config
Returns when the configuration tree was created.Each config node of single Config tree returns same timestamp.
- Specified by:
timestamp
in interfaceConfig
- Returns:
- timestamp of created instance of whole configuration tree.
- See Also:
Config.context()
,Config.Context.timestamp()
-
key
public Config.Key key()
Deprecated.Description copied from interface:Config
Returns the fully-qualified key of theConfig
node.The fully-qualified key is a sequence of tokens derived from the name of each node along the path from the config root to the current node. Tokens are separated by
.
(the dot character). SeeConfig.name()
for more information on the format of each token.- Specified by:
key
in interfaceConfig
- Returns:
- current config node key
- See Also:
Config.name()
-
get
public Config get(Config.Key key)
Deprecated.Description copied from interface:Config
Returns the single sub-node for the specified sub-key.- Specified by:
get
in interfaceConfig
- Parameters:
key
- sub-key of requested sub-node- Returns:
- config node for specified sub-key, never returns
null
. - See Also:
Config.get(String)
-
detach
public Config detach()
Deprecated.Description copied from interface:Config
Returns a copy of theConfig
node with no parent.The returned node acts as a root node for the subtree below it. Its key is the empty string;
""
. The original config node is unchanged, and the original and the copy point to the same children.Consider the following configuration:
app: name: Example 1 page-size: 20 logging: app.level = INFO level = WARNING
TheConfig
instancesname1
andname2
represents same data and in fact refer to the same object:Config name1 = config .get("app") .get("name"); Config name2 = config .get("app") .detach() //DETACHED node .get("name"); assert name1.asString() == "Example 1"; assert name2.asString() == "Example 1"; //DETACHED node
The only difference is the key each node returns:assert name1.key() == "app.name"; assert name2.key() == "name"; //DETACHED node
See
Config.asMap()
for example of config detaching.
-
type
public Config.Type type()
Deprecated.Description copied from interface:Config
Provides theConfig.Type
of theConfig
node.
-
hasValue
public boolean hasValue()
Deprecated.Description copied from interface:Config
Returnstrue
if this configuration node has a direct value.This may be a value node (e.g. a leaf) or object node or a list node (e.g. a branch with value). The application can invoke methods such as
Config.as(Class)
on nodes that have value.
-
traverse
public Stream<Config> traverse(Predicate<Config> predicate)
Deprecated.Description copied from interface:Config
Iterative deepening depth-first traversal of the node and its subtree as aStream<Config>
, qualified by the specified predicate.If the config node does not exist or is a leaf the returned stream is empty.
Depending on the structure of the configuration the returned stream can deliver a mix of object, list, and leaf value nodes. The stream will include and traverse through object members and list elements.
The traversal continues as long as the specified
predicate
evaluates totrue
. When the predicate evaluates tofalse
the node being traversed and its subtree will be excluded from the returnedStream<Config>
.
-
convert
public <T> T convert(Class<T> type, String value)
Deprecated.Description copied from interface:Config
Convert a String to a specific type. This is a helper method to allow for processing of default values that cannot be typed (e.g. in annotations).- Specified by:
convert
in interfaceConfig
- Type Parameters:
T
- type- Parameters:
type
- type of the propertyvalue
- String value- Returns:
- instance of the correct type
- See Also:
Config.as(Class)
-
as
public <T> ConfigValue<T> as(GenericType<T> genericType)
Deprecated.Description copied from interface:Config
Typed value as aConfigValue
for a generic type. If appropriate mapper exists, returns a properly typed generic instance.Example:
ConfigValue<Map<String, Integer>> myMapValue = config.as(new GenericType<Map<String, Integer>>(){}); myMapValue.ifPresent(map -> { Integer port = map.get("service.port"); }
-
as
public <T> ConfigValue<T> as(Class<T> type)
Deprecated.Description copied from interface:Config
Typed value as aConfigValue
.- Specified by:
as
in interfaceConfig
- Type Parameters:
T
- type- Parameters:
type
- type class- Returns:
- typed value
- See Also:
ConfigValue.map(Function)
,ConfigValue.supplier()
,ConfigValue.get()
,ConfigValue.orElse(Object)
-
as
public <T> ConfigValue<T> as(Function<Config,T> mapper)
Deprecated.Description copied from interface:Config
Typed value as aConfigValue
created from factory method. To convert from String, you can useconfig.asString()
.as(Function)
.
-
asList
public <T> ConfigValue<List<T>> asList(Class<T> type)
Deprecated.Description copied from interface:Config
Returns list of specified type.
-
asList
public <T> ConfigValue<List<T>> asList(Function<Config,T> mapper)
Deprecated.Description copied from interface:Config
Returns this node as a list converting each list value using the provided mapper.
-
asNodeList
public ConfigValue<List<Config>> asNodeList()
Deprecated.Description copied from interface:Config
Returns a list of childConfig
nodes if the node isConfig.Type.OBJECT
. Returns a list of element nodes if the node isConfig.Type.LIST
. ThrowsMissingValueException
if the node isConfig.Type.MISSING
. Otherwise, if node isConfig.Type.VALUE
, it throwsConfigMappingException
.- Specified by:
asNodeList
in interfaceConfig
- Returns:
- a list of
Config.Type.OBJECT
members or a list ofConfig.Type.LIST
members
-
asMap
public ConfigValue<Map<String,String>> asMap()
Deprecated.Description copied from interface:Config
Transform all leaf nodes (values) into Map instance.Fully qualified key of config node is used as a key in returned Map.
Detach
config node before transforming to Map in case you want to cut current Config node key prefix.Let's say we work with following configuration:
app: name: Example 1 page-size: 20 logging: app.level = INFO level = WARNING
Mapapp1
contains two keys:app.name
,app.page-size
.Map<String, String> app1 = config.get("app").asMap();
Detaching
app
config node returns new Config instance with "reset" local root.
MapMap<String, String> app2 = config.get("app").detach().asMap();
app2
contains two keys withoutapp
prefix:name
,page-size
.- Specified by:
asMap
in interfaceConfig
- Returns:
- new Map instance that contains all config leaf node values
- See Also:
Config.traverse()
,Config.detach()
-
mapper
public ConfigMapper mapper()
Deprecated.Description copied from interface:Config
The mapper used by this config instance.
-
getOptionalValue
public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType)
Deprecated.- Specified by:
getOptionalValue
in interfaceConfig
-
getPropertyNames
public Iterable<String> getPropertyNames()
Deprecated.- Specified by:
getPropertyNames
in interfaceConfig
-
getConfigSources
public Iterable<ConfigSource> getConfigSources()
Deprecated.- Specified by:
getConfigSources
in interfaceConfig
-
delegate
public Config delegate()
Deprecated.Get the underlying instance of this delegate pattern.- Returns:
- the instance backing this config delegate
-
-