public class PropertyTree extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PropertyTree.Node
The node of the
PropertyTree . |
Modifier and Type | Method and Description |
---|---|
Optional<PropertyTree.Node> |
find(Iterable<String> path)
Finds the node at the given path.
|
Optional<PropertyTree.Node> |
find(String... path) |
static PropertyTree |
from(Dictionary<String,?> properties)
Create a new
PropertyTree from the given Dictionary . |
static PropertyTree |
from(Map<String,String> map)
Create a new
PropertyTree from the given Map . |
Map<String,String> |
getFlatMap(String... path)
Get the values of all child nodes at the given path, enumerating any subtrees and converting their
paths into dot-separated property names.
|
Map<String,String> |
getMap(String... path)
Get the values of all children nodes at the given path.
|
Optional<Boolean> |
getOptionalBoolean(String... path)
Get the value at the given path parsed as an
Boolean . |
Optional<Integer> |
getOptionalInteger(String... path)
Get the value at the given path parsed as an
Integer . |
String |
getRequiredString(String... path)
Get the value at the given path.
|
Map<String,PropertyTree> |
getSubTrees(String... path)
Get the children nodes at the given path represented as sub-trees.
|
public Optional<PropertyTree.Node> find(Iterable<String> path)
path
- the path of the node to return split into its elementsPropertyTree.Node
if there is a node on the given path or an Optional.empty()
value if one of the nodes in the path does not existpublic Optional<PropertyTree.Node> find(String... path)
find(Iterable)
public String getRequiredString(String... path)
path
- the path of the node to return split into its elementsNoSuchElementException
- if there is no such node or the node has no valuepublic Optional<Integer> getOptionalInteger(String... path)
Integer
.path
- the path of the node to return split into its elementsInteger
value of the node at the given path or Optional.empty()
if one of the nodes in the path does not existpublic Optional<Boolean> getOptionalBoolean(String... path)
Boolean
.path
- the path of the node to return split into its elementsInteger
value of the node at the given path or Optional.empty()
if one of the nodes in the path does not existpublic Map<String,String> getMap(String... path)
public Map<String,String> getFlatMap(String... path)
public Map<String,PropertyTree> getSubTrees(String... path)
Map
will contain an entry for each children of the addressed node. The name of the children will be used as key.
The value will be new PropertyTree
instance in which the children node is used as root node.public static PropertyTree from(Map<String,String> map)
PropertyTree
from the given Map
.
The keys of the map are handled as full-qualified dot-separated paths.map
- the path / value mapping used to create the property treePropertyTree
instancepublic static PropertyTree from(Dictionary<String,?> properties)
PropertyTree
from the given Dictionary
.
The keys of the properties are handled as full-qualified dot-separated paths.properties
- the path / value mapping used to create the property treePropertyTree
instanceCopyright © 2021. All rights reserved.