Serializable, Iterable<PropertyValue>ListValue, ObjectValuepublic class PropertyValue extends Object implements Serializable, Iterable<PropertyValue>
| Modifier and Type | Class | Description |
|---|---|---|
static class |
PropertyValue.ValueType |
Enum of the different supported value types.
|
| Modifier | Constructor | Description |
|---|---|---|
|
PropertyValue(String key) |
Creates a new instance
|
protected |
PropertyValue(String key,
String value) |
Creates a new instance
|
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
checkImmutable() |
|
static ListValue |
createList() |
Creates a new (invisible) root, which is a node with an empty name.
|
static ListValue |
createList(String key) |
Creates a new createValue of type
PropertyValue.ValueType.ARRAY. |
static ObjectValue |
createObject() |
Creates a new (invisible) root, which is a node with an empty name.
|
static ObjectValue |
createObject(String key) |
Creates a new createValue of type
PropertyValue.ValueType.MAP. |
static PropertyValue |
createValue(String key,
String value) |
Creates a new createValue of type
PropertyValue.ValueType.VALUE. |
protected PropertyValue |
deepClone() |
Creates a deep clone of this intance.
|
boolean |
equals(Object o) |
|
String |
getKey() |
The requested key.
|
Map<String,String> |
getMeta() |
Creates a full configuration map for this key, createValue pair and all its getMeta context data.
|
<T> T |
getMeta(String key) |
Access the given key from this createValue.
|
String |
getMetaEntry(String key) |
Deprecated.
Use
getMeta(String) instead of. |
PropertyValue |
getParent() |
Get the value's parent.
|
String |
getQualifiedKey() |
Get a qualified name of a value in property format using '.' as separator, e.g.
|
int |
getSize() |
Get the createValue's number of elements.
|
String |
getSource() |
Deprecated.
Use
getMeta("source"). |
String |
getValue() |
Get the node's createValue.
|
PropertyValue.ValueType |
getValueType() |
Get the item's current createValue type.
|
int |
getVersion() |
Get the values version, the version is updated with each change written.
|
int |
hashCode() |
|
PropertyValue |
immutable() |
Sets this instance and also all its direct an indirect children to immutable.
|
protected int |
incrementVersion() |
Called to mark a change on this instance.
|
boolean |
isImmutable() |
Checks if the instance is immutable.
|
boolean |
isLeaf() |
Checks if the value is a leaf value (has no values).
|
boolean |
isRoot() |
Checks if the value is a root value.
|
Iterator<PropertyValue> |
iterator() |
|
static Map<String,PropertyValue> |
mapProperties(Map<String,String> config,
String source) |
Maps a mapProperties of
Map<String,String> to a Map<String,PropertyValue>. |
static Map<String,PropertyValue> |
mapProperties(Map<String,String> config,
String source,
Map<String,String> metaData) |
Maps a mapProperties of
Map<String,String> to a Map<String,PropertyValue>. |
static Map<String,PropertyValue> |
mapProperties(Map<String,String> config,
String source,
Map<String,String> metaData,
String prefix) |
Maps a mapProperties of
Map<String,String> to a Map<String,PropertyValue>. |
PropertyValue |
mutable() |
Clones this instance and all it's children, marking as mutable createValue.
|
PropertyValue |
removeMeta(String key) |
Removes a getMeta entry.
|
PropertyValue |
setKey(String key) |
Changes the entry's key, mapping also corresponding context entries.
|
PropertyValue |
setMeta(String key,
Object value) |
Add an additional context data information.
|
PropertyValue |
setMeta(Map<String,String> metaEntries) |
Replaces/sets the context data.
|
protected PropertyValue |
setParent(PropertyValue parent) |
Sets the new parent, used iternally when converting between value types.
|
PropertyValue |
setValue(String value) |
Sets the createValue.
|
protected void |
setVersion(int version) |
Sets the new version, used iternally when cloning.
|
ListValue |
toListValue() |
Convert an instance to a List PropertyValue.
|
Map<String,String> |
toLocalMap() |
Convert the value tree to a property mapProperties using local keys.
|
Map<String,String> |
toMap() |
Convert the value tree to a property map.
|
ObjectValue |
toObjectValue() |
Convert an instance to a Object PropertyValue.
|
String |
toString() |
Create a String representation of the tree.
|
forEach, spliteratorpublic PropertyValue(String key)
key - the key, not null.public static ObjectValue createObject()
public static ListValue createList()
public static PropertyValue createValue(String key, String value)
PropertyValue.ValueType.VALUE.key - the key, not null.value - the createValue, not null.public static ListValue createList(String key)
PropertyValue.ValueType.ARRAY.key - the key, not null.public static ObjectValue createObject(String key)
PropertyValue.ValueType.MAP.key - the key, not null.public static Map<String,PropertyValue> mapProperties(Map<String,String> config, String source)
Map<String,String> to a Map<String,PropertyValue>.config - the String based mapProperties, not null.source - the source name, not null.public static Map<String,PropertyValue> mapProperties(Map<String,String> config, String source, Map<String,String> metaData)
Map<String,String> to a Map<String,PropertyValue>.config - the String based mapProperties, not null.source - the source name, not null.metaData - additional metadata, not null.public static Map<String,PropertyValue> mapProperties(Map<String,String> config, String source, Map<String,String> metaData, String prefix)
Map<String,String> to a Map<String,PropertyValue>.config - the String based mapProperties, not null.source - the source name, not null.metaData - additional metadata, not null.prefix - the prefix to add (optional).public final boolean isImmutable()
public PropertyValue immutable()
IllegalStateException.public PropertyValue mutable()
public PropertyValue.ValueType getValueType()
public final String getKey()
null.public String getValue()
@Deprecated public String getSource()
getMeta("source").public PropertyValue setValue(String value)
value - the createValueIllegalStateException - if the instance is immutable.isImmutable()public String getQualifiedKey()
a.b.c or a.b.c[0] for indexed entries. Entries hereby also can have multiple
levels of indexing, e.g. a[1].b.c[14].d is a valid option.
The qualified key is defined by getQualifiedKey() of it's parent concatenated with the key
of this node. If there is no parent, or the parent's qualified key is empty only getKey()
is returned. Additionally if the current values is an indeyed createValue the key is extended by the
index in brackets, e.g. [0], [1], .... All the subsequent keys are valid qualified keys:
a
a.b
a[0].b
[0]
a.b[4].c.d[0].[1].any
public final PropertyValue getParent()
public final int getVersion()
public final boolean isRoot()
public final boolean isLeaf()
public final Map<String,String> getMeta()
@Deprecated public String getMetaEntry(String key)
getMeta(String) instead of.key - the key, not null.null.public final <T> T getMeta(String key)
T - the target type.key - the key, not null.null.public int getSize()
public Iterator<PropertyValue> iterator()
iterator in interface Iterable<PropertyValue>public final PropertyValue setMeta(Map<String,String> metaEntries)
metaEntries - the context data to be applied, not null.IllegalStateException - if the instance is immutable.isImmutable()public final PropertyValue setMeta(String key, Object value)
key - the context data key, not null.value - the context createValue, not null (will be converted to String).IllegalStateException - if the instance is immutable.isImmutable()public final PropertyValue removeMeta(String key)
key - the entry's key, not null.IllegalStateException - if the instance is immutable.isImmutable()public Map<String,String> toMap()
public Map<String,String> toLocalMap()
public String toString()
public ObjectValue toObjectValue()
public ListValue toListValue()
protected PropertyValue deepClone()
protected final void checkImmutable()
IllegalStateException - if the instance is immutable.protected final int incrementVersion()
protected final void setVersion(int version)
version - the new version.public PropertyValue setKey(String key)
key - the new key, not null.IllegalStateException - if the instance is immutable.isImmutable()protected PropertyValue setParent(PropertyValue parent)
parent - the parent value.Copyright © 2014–2019 Apache Software Foundation. All rights reserved.