Class EmptyConfigProperties
- java.lang.Object
-
- com.devonfw.module.basic.common.api.config.EmptyConfigProperties
-
- All Implemented Interfaces:
ConfigProperties
class EmptyConfigProperties extends Object implements ConfigProperties
Implementation ofConfigPropertiesthat always isempty.- Since:
- 3.0.0
-
-
Field Summary
-
Fields inherited from interface com.devonfw.module.basic.common.api.config.ConfigProperties
EMPTY, KEY_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description EmptyConfigProperties()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigPropertiesgetChild(String key)ConfigPropertiesgetChild(String... keys)Set<String>getChildKeys()StringgetChildValue(String key)Shortcut forgetChild(key).ConfigProperties.getValue().StringgetChildValue(String... keys)Shortcut forgetChild(keys).ConfigProperties.getValue().StringgetValue()<T> TgetValue(Class<T> type)<T> TgetValue(Class<T> type, T defaultValue)booleangetValueAsBoolean()MutableConfigPropertiesinherit(ConfigProperties parent)booleanisEmpty()Map<String,String>toFlatMap()Map<String,String>toFlatMap(String rootKey)Map<String,Object>toHierarchicalMap()StringtoString()
-
-
-
Method Detail
-
getChildKeys
public Set<String> getChildKeys()
- Specified by:
getChildKeysin interfaceConfigProperties- Returns:
- the
Setof thedirect child keysavailable in theConfigProperties-node.
-
getChild
public ConfigProperties getChild(String key)
- Specified by:
getChildin interfaceConfigProperties- Parameters:
key- thechild keyof the requested configuration value.- Returns:
- the child
ConfigProperties. Will be anemptychild if undefined.
-
getChild
public ConfigProperties getChild(String... keys)
Description copied from interface:ConfigPropertiesRecursive variant ofConfigProperties.getChild(String)such thatis the same asconfig.getChild(key1, ..., keyN).config.getChild(key1)...getChild(keyN)- Specified by:
getChildin interfaceConfigProperties- Parameters:
keys- the keys to traverse recursively.- Returns:
- the descendant
childreached from recursively traversing the givenkeys.
-
getChildValue
public String getChildValue(String key)
Description copied from interface:ConfigPropertiesShortcut forgetChild(key).ConfigProperties.getValue().- Specified by:
getChildValuein interfaceConfigProperties- Parameters:
key- thekey of the child- Returns:
- the value of this
ConfigProperties-node. May benull.
-
getChildValue
public String getChildValue(String... keys)
Description copied from interface:ConfigPropertiesShortcut forgetChild(keys).ConfigProperties.getValue().- Specified by:
getChildValuein interfaceConfigProperties- Parameters:
keys- the keys to traverse recursively.- Returns:
- the
valueof thedescendant childtraversed bykeys. May benull.
-
getValue
public String getValue()
- Specified by:
getValuein interfaceConfigProperties- Returns:
- the value of this
ConfigProperties-node. May benull.
-
getValue
public <T> T getValue(Class<T> type)
- Specified by:
getValuein interfaceConfigProperties- Type Parameters:
T- the requestedtype- Parameters:
type- theClassreflecting the requested result type.- Returns:
- the value of this
ConfigProperties-node converted to the giventype. Will benullif undefined.
-
getValue
public <T> T getValue(Class<T> type, T defaultValue)
- Specified by:
getValuein interfaceConfigProperties- Type Parameters:
T- the requestedtype- Parameters:
type- theClassreflecting the requested result type.defaultValue- the value returned as default if the actualvalueis undefined.- Returns:
- the value of this
ConfigProperties-node converted to the giventype. Will bedefaultValueif undefined.
-
getValueAsBoolean
public boolean getValueAsBoolean()
- Specified by:
getValueAsBooleanin interfaceConfigProperties- Returns:
- the
ConfigProperties.getValue(Class, Object)asbooleanwithfalseas default.
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceConfigProperties- Returns:
trueif this is an emptyConfigProperties-node that neither has avaluenoranychild.
-
toFlatMap
public Map<String,String> toFlatMap()
- Specified by:
toFlatMapin interfaceConfigProperties- Returns:
- this
ConfigPropertiesconverted to aflatMap.
-
toFlatMap
public Map<String,String> toFlatMap(String rootKey)
- Specified by:
toFlatMapin interfaceConfigProperties- Parameters:
rootKey- the root key used as prefix for thekeysseparated with a dot if notempty. Typically the emptyString.- Returns:
- this
ConfigPropertiesconverted to aflatMap.
-
toHierarchicalMap
public Map<String,Object> toHierarchicalMap()
- Specified by:
toHierarchicalMapin interfaceConfigProperties- Returns:
- this
ConfigPropertiesconverted to ahierarchicalMap.
-
inherit
public MutableConfigProperties inherit(ConfigProperties parent)
- Specified by:
inheritin interfaceConfigProperties- Parameters:
parent- the parentConfigPropertiesto extend.- Returns:
- a new instance of
ConfigPropertieswith allchildrenandvalue(s) from thisConfigProperties-tree and allchildrenandvalue(s) inherited from the givenparentConfigProperties-tree if they are undefined in this tree.
-
-