public class ValueContainer extends Object implements Serializable
Note: this is example code only, a version of this class may be be included in the common config module at some point in the future.
Constructor and Description |
---|
ValueContainer()
Construct an empty value container.
|
ValueContainer(Map<String,com.sdl.delivery.configuration.Value> valueMap)
Construct the container and populate it with a map of values.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String key,
com.sdl.delivery.configuration.Value value)
Add a value to the container.
|
com.sdl.delivery.configuration.Value |
get(String valueKey)
Returns a Value for the specified key, this never returns a null.
|
Set<String> |
getAllPropertyKeys()
Returns the keys of the all property values held within the container.
|
Set<String> |
getChildConfigKeys()
Returns the keys of the "top level" ChildConfigValues within this
container (i.e.
|
Set<String> |
getChildKeys()
Returns the keys of the "top level" property values and ChildConfigValues.
|
Set<String> |
getChildPropertyKeys()
Returns the keys of the "top level" property values (that aren't "owned" by a child
ChildConfigValue).
|
boolean |
hasValues() |
boolean |
isEmpty() |
public void add(String key, com.sdl.delivery.configuration.Value value)
key
- the property name of the valuevalue
- the valuepublic Set<String> getAllPropertyKeys()
So if the container held property values:
myproperty = 0 module1.myproperty1 = value1 module2.submodule1.myproperty1 = value2 module2.submodule1.myproperty2 = value3 lastproperty = value4
This getAllPropertyKeys() method would return:
1) "myproperty" 2) "module1.myproperty1" 3) "module2.submodule1.myproperty1" 4) "module2.submodule1.myproperty2" 5) "lastproperty"
public Set<String> getChildConfigKeys()
The term "top level" means that it won't return any ChildConfigValues which are "grandchildren".
As it will only return the "top level" children, none of the keys names returned will have embedded dots.
So if the container held property values:
myproperty = 0 module1.myproperty1 = value1 module2.submodule1.myproperty1 = value2 module2.submodule1.myproperty2 = value3 lastproperty = value4
This getChildConfigKeys() method would return:
1) "module1" - Child Configuration value 2) "module2" - Child Configuration value
it wouldn't return "module2.submodule1"
public Set<String> getChildPropertyKeys()
So if the container held property values:
myproperty = 0 module1.myproperty1 = value1 module2.submodule1.myproperty1 = value2 module2.submodule1.myproperty2 = value3 lastproperty = value4
The getChildPropertyValueKeys() method would return:
1) "myproperty" - numeric value 2) "lastproperty" - string value
It wouldn't return "module1.myproperty1" as this is logically a child of "module1".
public Set<String> getChildKeys()
So if the container held property values:
myproperty = 0 module1.myproperty1 = value1 module2.submodule1.myproperty1 = value2 module2.submodule1.myproperty2 = value3 lastproperty = value4
The getChildKeys() method would return:
1) "myproperty" - which would relate to a Numeric value 2) "module1" - which would relate to a Child Configuration value 3) "module2" - which would relate to a Child Configuration value 4) "lastproperty" - which would relate to a String value
public com.sdl.delivery.configuration.Value get(String valueKey)
So if the container held property values:
myproperty = 0 module1.myproperty1 = value1 module2.submodule1.myproperty1 = value2 module2.submodule1.myproperty2 = value3 lastproperty = value4
Calling the method with the following keys would give results as follows
get("myproperty") would return a numeric value of 0 get("module1.myproperty1") would return a string value of "value1" get("module1") would return a child configuration value (which contained "myproperty1") get("module1").get("myproperty1") would return a string value of "value1" get("unknown") would return a NullValue object get("unknown").get("unknown") would also return a NullValue object
valueKey
- the value keypublic boolean hasValues()
public boolean isEmpty()
Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries