Package org.refcodes.structure
Interface PathMap.MutablePathMap<T>
-
- Type Parameters:
T
- The type of the terminating elements.
- All Superinterfaces:
Clearable
,Containable
,org.refcodes.mixin.DelimiterAccessor
,Dictionary<java.lang.String,T>
,Dictionary.MutableDictionary<java.lang.String,T>
,org.refcodes.mixin.Dumpable
,Keys<java.lang.String,T>
,Keys.MutableKeys<java.lang.String,T>
,Keys.MutableValues<java.lang.String,T>
,java.util.Map<java.lang.String,T>
,PathMap<T>
,org.refcodes.mixin.TypeAccessor<T>
- All Known Subinterfaces:
CanonicalMap.CanonicalMapBuilder
,CanonicalMap.MutableCanonicalMap
,PathMap.PathMapBuilder<T>
- All Known Implementing Classes:
CanonicalMapBuilderImpl
,PathMapBuilderImpl
public static interface PathMap.MutablePathMap<T> extends PathMap<T>, Dictionary.MutableDictionary<java.lang.String,T>, java.util.Map<java.lang.String,T>
Extends thePathMap
with mutator functionality.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.DelimiterAccessor
org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
-
Nested classes/interfaces inherited from interface org.refcodes.structure.Dictionary
Dictionary.MutableDictionary<K,V>
-
Nested classes/interfaces inherited from interface org.refcodes.structure.Dictionary.MutableDictionary
Dictionary.MutableDictionary.DictionaryBuilder<K,V,B extends Dictionary.MutableDictionary.DictionaryBuilder<K,V,B>>
-
Nested classes/interfaces inherited from interface org.refcodes.structure.Keys
Keys.MutableKeys<K,V>, Keys.MutableValues<K,V>
-
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K extends java.lang.Object,V extends java.lang.Object>
-
Nested classes/interfaces inherited from interface org.refcodes.structure.PathMap
PathMap.MutablePathMap<T>, PathMap.PathMapBuilder<T>
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default T
delete(java.lang.String aKey)
Removes an element identified by the given key.default void
insert(java.lang.Object aFrom)
Inspects the given object and adds all elements found in the given object.default void
insert(java.lang.String aToPath, java.lang.Object aFrom, java.lang.String aFromPath)
Same asinsert(Object)
though starting insertion of object's introspected values at the given "to-path" and starting object introspection at the given "from-path", e.g. ignoring all paths not starting with the given path during the introspection process.default void
insert(java.lang.String aToPath, PathMap<T> aFrom, java.lang.String aFromPath)
Method to semantically emphasize that we support our own types.default void
insert(PathMap<T> aFrom)
Method to semantically emphasize that we support our own types.default void
insertFrom(java.lang.Object aFrom, java.lang.String aFromPath)
Same asinsert(Object)
though starting object introspection at the given "path", e.g. ignoring all paths not starting with the given path during the introspection process.default void
insertFrom(PathMap<T> aFrom, java.lang.String aFromPath)
Method to semantically emphasize that we support our own types.default void
insertTo(java.lang.String aToPath, java.lang.Object aFrom)
Same asinsert(Object)
though starting insertion of object's introspected values at the given "path".default void
insertTo(java.lang.String aToPath, PathMap<T> aFrom)
Method to semantically emphasize that we support our own types.default T
put(java.lang.String aParentPath, java.lang.String aChildPath, T aValue)
Puts the given value into the child's path, relative to the given parent's path.default T
put(Relation<java.lang.String,T> aRelation)
Adds the given element related to the given key.default T[]
putArray(java.lang.String aPath, T[] aValues)
Sets the records below the given path in an array and replaces any existing array.default T[]
putArray(T[] aValues)
Applies theputArray(Object[])
method for the root path "/".default void
removeAll(java.lang.String aPath)
Removes all properties below the provided path.-
Methods inherited from interface org.refcodes.structure.Containable
isEmpty, size
-
Methods inherited from interface org.refcodes.structure.Keys
containsKey, containsValue, get, get, keySet, use, values
-
Methods inherited from interface org.refcodes.structure.Keys.MutableValues
put
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from interface org.refcodes.structure.PathMap
childrenOf, directories, directories, entries, entries, fromExternalKey, getArray, getArray, getRootPath, hasParentPath, isArray, isArray, isDirectory, isEntry, isRecord, isRootPath, keySet, paths, paths, records, records, retrieve, retrieveFrom, retrieveTo, toDataStructure, toDataStructure, toExternalKey, toMap, toMap, toNormalizedPath, toNormalizedPath, toParentPath, toPath
-
-
-
-
Method Detail
-
put
default T put(Relation<java.lang.String,T> aRelation)
Adds the given element related to the given key.- Specified by:
put
in interfaceDictionary.MutableDictionary<java.lang.String,T>
- Parameters:
aRelation
- the relation- Returns:
- The value being replaced by the provided value or null if none value has been replaced.
-
putArray
default T[] putArray(T[] aValues)
Applies theputArray(Object[])
method for the root path "/".- Parameters:
aValues
- The values to be put.- Returns:
- An array of the records being replaced by the provided elements.
-
putArray
default T[] putArray(java.lang.String aPath, T[] aValues)
Sets the records below the given path in an array and replaces any existing array. Records in aPathMap
are reckoned to be part of an array when they belong to the same hierarchy level and when their keys represent integer numbers. Given the below example, the elements below "/animals/dogs" can be represented as an array with five elements (the path is denoted at the left hand side of the assignment ":=" operator and the value at the right and side accordingly):- "/animals/dogs/0" := "ace"
- "/animals/dogs/1" := "bandit"
- "/animals/dogs/2" := "radar"
- "/animals/dogs/3" := "echo"
- "/animals/dogs/4" := "snoopy"
PathMap.getArray(String)
for the path "/animals/dogs" would contain {"ace", "bandit", "radar", "echo", "snoopy"}. CallingisArray("/animals/dogs")
would returntrue
whereas callingisArray("/animals")
would return false.- Parameters:
aPath
- the pathaValues
- The values to be put.- Returns:
- An array of the records being replaced by the provided elements.
-
delete
default T delete(java.lang.String aKey)
Removes an element identified by the given key.- Specified by:
delete
in interfaceKeys.MutableKeys<java.lang.String,T>
- Parameters:
aKey
- The key which's element is to be removed.- Returns:
- The value being removed.
-
removeAll
default void removeAll(java.lang.String aPath)
Removes all properties below the provided path.- Parameters:
aPath
- The path from where to remove all properties.
-
put
default T put(java.lang.String aParentPath, java.lang.String aChildPath, T aValue)
Puts the given value into the child's path, relative to the given parent's path.- Parameters:
aParentPath
- The parent's path relative to which to put the value.aChildPath
- The child's path, targets the value relative to the parent's path.aValue
- The value to be added.- Returns:
- The replaced value in case a value has already been set for the resulting path, or null.
-
insert
default void insert(java.lang.Object aFrom)
Inspects the given object and adds all elements found in the given object. Elements of typeMap
,Collection
and arrays are identified and handled as of their type: The path for each value in aMap
is appended with its according key. The path for each value in aCollection
or array is appended with its according index of occurrence (in case of aList
or an array, its actual index). In case of reflection, the path for each member is appended with its according mamber's name. All elements (e.g. the members and values) are inspected recursively which results in the according paths of the terminating values.- Parameters:
aFrom
- The object which is to be inspected with the therein contained values being added with their according determined paths.
-
insertFrom
default void insertFrom(java.lang.Object aFrom, java.lang.String aFromPath)
Same asinsert(Object)
though starting object introspection at the given "path", e.g. ignoring all paths not starting with the given path during the introspection process. The resulting paths do not start with the provided path.- Parameters:
aFrom
- The object which is to be inspected with the therein contained values being added with their according determined paths.aFromPath
- The path from where to start adding elements of the provided object.
-
insertTo
default void insertTo(java.lang.String aToPath, java.lang.Object aFrom)
Same asinsert(Object)
though starting insertion of object's introspected values at the given "path".- Parameters:
aToPath
- The sub-path where to insert the object's introspected values to.aFrom
- The object which is to be inspected with the therein contained values being added with their according determined paths.
-
insert
default void insert(java.lang.String aToPath, java.lang.Object aFrom, java.lang.String aFromPath)
Same asinsert(Object)
though starting insertion of object's introspected values at the given "to-path" and starting object introspection at the given "from-path", e.g. ignoring all paths not starting with the given path during the introspection process. The resulting paths do not start with the "from-path" path, them start with the given "to-path".- Parameters:
aToPath
- The sub-path where to insert the object's introspected values to.aFrom
- The object which is to be inspected with the therein contained values being added with their according determined paths.aFromPath
- The path from where to start adding elements of the provided object.
-
insert
default void insert(PathMap<T> aFrom)
Method to semantically emphasize that we support our own types. Actually delegates toinsert(Object)
.- Parameters:
aFrom
- ThePathMap
which is to be inspected with the therein contained values being added with their according determined paths.
-
insertFrom
default void insertFrom(PathMap<T> aFrom, java.lang.String aFromPath)
Method to semantically emphasize that we support our own types. Actually delegates toinsertFrom(Object, String)
.- Parameters:
aFrom
- ThePathMap
which is to be inspected with the therein contained values being added with their according determined paths.aFromPath
- The path from where to start adding elements of the provided object.
-
insertTo
default void insertTo(java.lang.String aToPath, PathMap<T> aFrom)
Method to semantically emphasize that we support our own types. Actually delegates toinsertTo(String, Object)
.- Parameters:
aToPath
- The sub-path where to insert the object's introspected values to.aFrom
- ThePathMap
which is to be inspected with the therein contained values being added with their according determined paths.
-
insert
default void insert(java.lang.String aToPath, PathMap<T> aFrom, java.lang.String aFromPath)
Method to semantically emphasize that we support our own types. Actually delegates toinsert(String, Object, String)
.- Parameters:
aToPath
- The sub-path where to insert the object's introspected values to.aFrom
- ThePathMap
which is to be inspected with the therein contained values being added with their according determined paths.aFromPath
- The path from where to start adding elements of the provided object.
-
-