- java.lang.Object
-
- org.refcodes.struct.PathMapBuilderImpl<T>
-
- Type Parameters:
T- the generic type of the elements to be contained herein.
- All Implemented Interfaces:
Serializable,Map<String,T>,org.refcodes.mixin.AnnotatorAccessor,org.refcodes.mixin.Clearable,org.refcodes.mixin.DelimiterAccessor,org.refcodes.mixin.Dumpable,org.refcodes.mixin.EmptyAccessor,org.refcodes.mixin.TypeAccessor<T>,Containable,Dictionary<String,T>,Dictionary.MutableDictionary<String,T>,Dictionary.MutableDictionary.DictionaryBuilder<String,T,PathMap.PathMapBuilder<T>>,Keys<String,T>,Keys.MutableKeys<String,T>,Keys.MutableValues<String,T>,PathMap<T>,PathMap.MutablePathMap<T>,PathMap.PathMapBuilder<T>
- Direct Known Subclasses:
CanonicalMapBuilderImpl,ClassStructMapBuilderImpl,SimpleTypeMapBuilderImpl
public class PathMapBuilderImpl<T> extends Object implements PathMap.PathMapBuilder<T>, Serializable
The Class PathMapBuilderImpl.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.AnnotatorAccessor
org.refcodes.mixin.AnnotatorAccessor.AnnotatorBuilder<B extends org.refcodes.mixin.AnnotatorAccessor.AnnotatorBuilder<B>>, org.refcodes.mixin.AnnotatorAccessor.AnnotatorMutator, org.refcodes.mixin.AnnotatorAccessor.AnnotatorProperty
-
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.struct.Dictionary
Dictionary.MutableDictionary<K,V>
-
Nested classes/interfaces inherited from interface org.refcodes.struct.Dictionary.MutableDictionary
Dictionary.MutableDictionary.DictionaryBuilder<K,V,B extends Dictionary.MutableDictionary.DictionaryBuilder<K,V,B>>
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.EmptyAccessor
org.refcodes.mixin.EmptyAccessor.EmptyMutator, org.refcodes.mixin.EmptyAccessor.EmptyProperty
-
Nested classes/interfaces inherited from interface org.refcodes.struct.Keys
Keys.MutableKeys<K,V>, Keys.MutableValues<K,V>
-
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K extends Object,V extends Object>
-
Nested classes/interfaces inherited from interface org.refcodes.struct.PathMap
PathMap.MutablePathMap<T>, PathMap.PathMapBuilder<T>
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.TypeAccessor
org.refcodes.mixin.TypeAccessor.TypeBuilder<T extends Object,B extends org.refcodes.mixin.TypeAccessor.TypeBuilder<T,B>>, org.refcodes.mixin.TypeAccessor.TypeMutator<T extends Object>, org.refcodes.mixin.TypeAccessor.TypeProperty<T extends Object>
-
-
Constructor Summary
Constructors Constructor Description PathMapBuilderImpl(char aDelimiter, Class<T> aType)Create aPathMap.PathMapBuilderinstance using the provided path delimiter for the path declarations.PathMapBuilderImpl(Class<T> aType)Create an emptyPathMap.PathMapBuilderinstance using the default path delimiter "/" (Delimiter.PATH) for the path declarations.PathMapBuilderImpl(Object aObj, char aDelimiter, Class<T> aType)Creates aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).PathMapBuilderImpl(Object aObj, Class<T> aType)Create aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATH) for the path declarations.PathMapBuilderImpl(Object aObj, String aFromPath, char aDelimiter, Class<T> aType)Creates aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).PathMapBuilderImpl(Object aObj, String aFromPath, Class<T> aType)Creates aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATH) for the path declarations.PathMapBuilderImpl(String aToPath, Object aObj, char aDelimiter, Class<T> aType)Creates aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).PathMapBuilderImpl(String aToPath, Object aObj, Class<T> aType)Create aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATH) for the path declarations.PathMapBuilderImpl(String aToPath, Object aObj, String aFromPath, char aDelimiter, Class<T> aType)Create aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).PathMapBuilderImpl(String aToPath, Object aObj, String aFromPath, Class<T> aType)Creates aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATHfor the path declarations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Tcompute(String aPath, BiFunction<? super String,? super T,? extends T> remappingFunction)TcomputeIfAbsent(String aPath, Function<? super String,? extends T> mappingFunction)TcomputeIfPresent(String aPath, BiFunction<? super String,? super T,? extends T> remappingFunction)booleancontainsKey(Object aPath)Tests whether there is an element with the given key.booleancontainsValue(Object value)This method is defined for the sake ofMapconformity.protected Map<String,T>createBackingMap()Hook for creating an individual backingMapto be used by thePathMapBuilderImpl.Set<Map.Entry<String,T>>entrySet()booleanequals(Object o)voidforEach(BiConsumer<? super String,? super T> action)protected TfromInstance(Object aValue)Hook method when introspecting an object to help conversion of that object to the target types.protected PathMap<T>fromObject(Object aFrom)protected voidfromValue(String aToPath, Object aObj)Hook method for intercepting or modifying the process of object introspection.protected voidfromValue(String aToPath, Object aValue, Set<Object> aVisited)Tget(Object aPath)Retrieves the element assigned to the given key.chargetAnnotator()chargetDelimiter()TgetOrDefault(Object aPath, T publicValue)Class<T>getType()inthashCode()voidinsert(Object aFrom)Inspects the given object and adds all elements found in the given object.voidinsertBetween(String aToPath, Object aFrom, String aFromPath)Same asPathMap.MutablePathMap.insert(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.voidinsertFrom(Object aFrom, String aFromPath)Same asPathMap.MutablePathMap.insert(Object)though starting object introspection at the given "path", e.g. ignoring all paths not starting with the given path during the introspection process.voidinsertTo(String aToPath, Object aFrom)Same asPathMap.MutablePathMap.insert(Object)though starting insertion of object's introspected values at the given "path".booleanisEmpty()Set<String>keySet()Retrieves a collection containing all the keys found in the elements of this collection.voidmerge(Object aFrom)Inspects the given object and adds all elements found in the given object in case the targeted path does not exist or points to a null value.Tmerge(String aPath, T value, BiFunction<? super T,? super T,? extends T> remappingFunction)voidmergeBetween(String aToPath, Object aFrom, String aFromPath)Same asPathMap.MutablePathMap.merge(Object)though starting merging 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.voidmergeFrom(Object aFrom, String aFromPath)Same asPathMap.MutablePathMap.merge(Object)though starting object introspection at the given "path", e.g. ignoring all paths not starting with the given path during the introspection process.voidmergeTo(String aToPath, Object aFrom)Same asPathMap.MutablePathMap.merge(Object)though starting merging of object's introspected values at the given "path".Tput(String aPath, T aValue)Puts an element identified by the given key.voidputAll(Map<? extends String,? extends T> m)TputIfAbsent(String aPath, T value)Tremove(Object aPath)booleanremove(Object aPath, Object value)Treplace(String aPath, T value)booleanreplace(String aPath, T oldValue, T newValue)voidreplaceAll(BiFunction<? super String,? super T,? extends T> function)PathMap<T>retrieveFrom(String aFromPath)PathMap<T>retrieveTo(String aToPath)intsize()Returns the number of data elements contained in the collection.ObjecttoDataStructure(String aFromPath)Similar to thePathMap.toMap(String)method, though in case all the keys of a nestedMapinstance (applicable to the rootMapas well) represent an array (as ofPathMap.getArray( String)), then an array is generated where the index of each value in theMapis represented by the number representation of theMap's key for that value.protected <TYPE> TYPEtoInstance(T aValue, Class<TYPE> aType)Hook method when reconstructing an object, opposite offromInstance(Object), tries to convert the given value to the desired type.StringtoString()<TYPE> TYPEtoType(String aFromPath, Class<TYPE> aType)Creates an instance of the given type filled with thisPathMap's data.Collection<T>values()Returns aCollectionview of the values related to the contained keys.PathMap.PathMapBuilder<T>withPut(String aKey, T aValue)Builder method forKeys.MutableValues.put(Object, Object).-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.refcodes.struct.PathMap
children, children, children, children, children, children, containsKey, containsKey, containsKey, dirs, dirs, dirs, dirs, dirs, dirs, findPaths, fromExternalPath, get, get, get, getArray, getArray, getArray, getArray, getArray, getArrayIndexes, getArrayIndexes, getArrayIndexes, getArrayIndexes, getArrayIndexes, getDir, getDir, getDir, getDir, getDir, getDirAt, getDirAt, getDirAt, getDirAt, getDirAt, getDirAt, getDirIndexes, getDirIndexes, getDirIndexes, getDirIndexes, getDirIndexes, getRootPath, getValueAt, getValueAt, getValueAt, getValueAt, getValueAt, getValueAt, hasChildren, hasChildren, hasChildren, hasChildren, hasChildren, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasParentPath, hasPath, hasPath, hasPath, hasPath, hasSubDirs, hasSubDirs, hasSubDirs, hasSubDirs, hasValue, hasValue, hasValue, hasValue, hasValue, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, isArray, isArray, isArray, isArray, isArray, isArray, isChild, isChild, isChild, isChild, isDir, isDir, isDir, isDir, isDir, isEqualTo, isIndexDir, isIndexDir, isIndexDir, isIndexDir, isIndexDir, isLeaf, isLeaf, isLeaf, isLeaf, isLeaf, isRootPath, keySet, keySet, keySet, keySet, keySet, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, leaves, leaves, leaves, leaves, leaves, leaves, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, paths, paths, paths, paths, paths, paths, query, query, query, query, query, queryBetween, queryBetween, queryBetween, queryBetween, queryBetween, queryBetween, queryFrom, queryFrom, queryFrom, queryFrom, queryFrom, queryFrom, queryPaths, queryPaths, queryPaths, queryPaths, queryPaths, queryPaths, queryTo, queryTo, queryTo, queryTo, queryTo, queryTo, retrieveBetween, retrieveBetween, retrieveBetween, retrieveBetween, retrieveBetween, retrieveFrom, retrieveFrom, retrieveFrom, retrieveFrom, retrieveTo, retrieveTo, retrieveTo, retrieveTo, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, toDataStructure, toExternalPath, toInstance, toInstance, toLeaf, toMap, toMap, toNormalizedPath, toParentPath, toPath, toPath, toPath, toPath, toPathElements, toPathList, toPathStack, toPropertyPath, toType, toType, toType, toType, toType, toType, toType
-
Methods inherited from interface org.refcodes.struct.PathMap.MutablePathMap
add, add, add, add, add, add, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendDirTo, appendValueTo, appendValueTo, appendValueTo, appendValueTo, appendValueTo, appendValueTo, delete, delete, delete, delete, delete, insert, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertBetween, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertFrom, insertTo, insertTo, insertTo, insertTo, insertTo, insertTo, insertTo, insertTo, insertTo, merge, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeBetween, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, mergeTo, put, put, put, put, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putArray, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putDirAt, putValueAt, putValueAt, putValueAt, putValueAt, putValueAt, putValueAt, remove, remove, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeAll, removeDirAt, removeDirAt, removeDirAt, removeDirAt, removeDirAt, removeFrom, removeFrom, removeFrom, removeFrom, removeFrom, removePaths, removePaths, removeValueAt, removeValueAt, removeValueAt, removeValueAt, removeValueAt, toSourceCode, toSourceCode
-
Methods inherited from interface org.refcodes.struct.PathMap.PathMapBuilder
withInsert, withInsert, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertBetween, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertFrom, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withInsertTo, withMerge, withMerge, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeBetween, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeFrom, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withMergeTo, withPut, withPut, withPut, withPut, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withPutDirAt, withRemoveFrom, withRemoveFrom, withRemoveFrom, withRemoveFrom, withRemoveFrom, withRemovePaths
-
-
-
-
Constructor Detail
-
PathMapBuilderImpl
public PathMapBuilderImpl(Class<T> aType)
Create an emptyPathMap.PathMapBuilderinstance using the default path delimiter "/" (Delimiter.PATH) for the path declarations.- Parameters:
aType- The type of the values being referenced by the paths.
-
PathMapBuilderImpl
public PathMapBuilderImpl(char aDelimiter, Class<T> aType)Create aPathMap.PathMapBuilderinstance using the provided path delimiter for the path declarations.- Parameters:
aDelimiter- The path delimiter to be used for the path declarations.aType- The type of the values being referenced by the paths.
-
PathMapBuilderImpl
public PathMapBuilderImpl(Object aObj, Class<T> aType)
Create aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATH) for the path declarations.- Parameters:
aObj- The object from which the elements are to be added.aType- The type of the values being referenced by the paths.
-
PathMapBuilderImpl
public PathMapBuilderImpl(String aToPath, Object aObj, Class<T> aType)
Create aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATH) for the path declarations.- Parameters:
aToPath- The sub-path where to insert the object's introspected values to.aObj- The object from which the elements are to be added.aType- The type of the values being referenced by the paths.
-
PathMapBuilderImpl
public PathMapBuilderImpl(Object aObj, String aFromPath, Class<T> aType)
Creates aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATH) for the path declarations.- Parameters:
aObj- The object from which the elements are to be added.aFromPath- The path from where to start adding elements of the provided object.aType- The type of the values being referenced by the paths.
-
PathMapBuilderImpl
public PathMapBuilderImpl(String aToPath, Object aObj, String aFromPath, Class<T> aType)
Creates aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATHfor the path declarations.- Parameters:
aToPath- The sub-path where to insert the object's introspected values to.aObj- The object from which the elements are to be added.aFromPath- The path from where to start adding elements of the provided object.aType- The type of the values being referenced by the paths.
-
PathMapBuilderImpl
public PathMapBuilderImpl(Object aObj, char aDelimiter, Class<T> aType)
Creates aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).- Parameters:
aObj- The object from which the elements are to be added.aDelimiter- The path delimiter to be used for the path declarations.aType- The type of the values being referenced by the paths.
-
PathMapBuilderImpl
public PathMapBuilderImpl(String aToPath, Object aObj, char aDelimiter, Class<T> aType)
Creates aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).- Parameters:
aToPath- The sub-path where to insert the object's introspected values to.aObj- The object from which the elements are to be added.aDelimiter- The path delimiter to be used for the path declarations.aType- The type of the values being referenced by the paths.
-
PathMapBuilderImpl
public PathMapBuilderImpl(Object aObj, String aFromPath, char aDelimiter, Class<T> aType)
Creates aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).- Parameters:
aObj- The object from which the elements are to be added.aFromPath- The path from where to start adding elements of the provided object.aDelimiter- The path delimiter to be used for the path declarations.aType- The type of the values being referenced by the paths.
-
PathMapBuilderImpl
public PathMapBuilderImpl(String aToPath, Object aObj, String aFromPath, char aDelimiter, Class<T> aType)
Create aPathMap.PathMapBuilderinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).- Parameters:
aToPath- The sub-path where to insert the object's introspected values to.aObj- The object from which the elements are to be added.aFromPath- The path from where to start adding elements of the provided object.aDelimiter- The path delimiter to be used for the path declarations.aType- The type of the values being referenced by the paths.
-
-
Method Detail
-
containsKey
public boolean containsKey(Object aPath)
Tests whether there is an element with the given key.- Specified by:
containsKeyin interfaceKeys<String,T>- Specified by:
containsKeyin interfaceMap<String,T>- Parameters:
aPath- The key for which to test whether there is an element.- Returns:
- True in case there is an element for the given key.
-
getOrDefault
public T getOrDefault(Object aPath, T publicValue)
- Specified by:
getOrDefaultin interfaceMap<String,T>
-
putIfAbsent
public T putIfAbsent(String aPath, T value)
- Specified by:
putIfAbsentin interfaceMap<String,T>
-
computeIfAbsent
public T computeIfAbsent(String aPath, Function<? super String,? extends T> mappingFunction)
- Specified by:
computeIfAbsentin interfaceMap<String,T>
-
computeIfPresent
public T computeIfPresent(String aPath, BiFunction<? super String,? super T,? extends T> remappingFunction)
- Specified by:
computeIfPresentin interfaceMap<String,T>
-
compute
public T compute(String aPath, BiFunction<? super String,? super T,? extends T> remappingFunction)
-
merge
public T merge(String aPath, T value, BiFunction<? super T,? super T,? extends T> remappingFunction)
-
retrieveTo
public PathMap<T> retrieveTo(String aToPath)
Extracts a newPathMapfrom thisPathMap's elements with the paths relocated to the provided "to-path". Given we have a value for path "/dog/cat" in thePathMapand we callPathMap.retrieveTo(String)with "/animals", then the resultingPathMapwill contain the path "/animals/dog/cat" for that value.
-
retrieveFrom
public PathMap<T> retrieveFrom(String aFromPath)
Extracts a newPathMapfrom the elements of thisPathMapfound below the "from-path". The sub-paths will be the root paths for the newPathMap. Given we have a value for path "/dog/cat" in thePathMapand we callPathMap.retrieveFrom(String)with "/dog", then the resultingPathMapwill contain the path "/cat" for that value.- Specified by:
retrieveFromin interfacePathMap<T>- Parameters:
aFromPath- The path from where to start extracting the paths.- Returns:
- The
PathMapwith the elements below the provided path which are root elements in the newPathMap.
-
getDelimiter
public char getDelimiter()
- Specified by:
getDelimiterin interfaceorg.refcodes.mixin.DelimiterAccessor
-
getAnnotator
public char getAnnotator()
- Specified by:
getAnnotatorin interfaceorg.refcodes.mixin.AnnotatorAccessor
-
getType
public Class<T> getType()
- Specified by:
getTypein interfaceorg.refcodes.mixin.TypeAccessor<T>
-
toDataStructure
public Object toDataStructure(String aFromPath)
Similar to thePathMap.toMap(String)method, though in case all the keys of a nestedMapinstance (applicable to the rootMapas well) represent an array (as ofPathMap.getArray( String)), then an array is generated where the index of each value in theMapis represented by the number representation of theMap's key for that value. The result is a data structure consisting ofMapinstances and arrays.- Specified by:
toDataStructurein interfacePathMap<T>- Parameters:
aFromPath- The path below which thePathMapto be converted into a data structure.- Returns:
- A data structure being a mixture of
Mapinstances and arrays representing the data below the given path.
-
insert
public void insert(Object aFrom)
Inspects the given object and adds all elements found in the given object. Elements of typeMap,Collectionand arrays are identified and handled as of their type: The path for each value in aMapis appended with its according key. The path for each value in aCollectionor array is appended with its according index of occurrence (in case of aListor 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.- Specified by:
insertin interfacePathMap.MutablePathMap<T>- Parameters:
aFrom- The object which is to be inspected with the therein contained values being added with their according determined paths.
-
insertBetween
public void insertBetween(String aToPath, Object aFrom, String aFromPath)
Same asPathMap.MutablePathMap.insert(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".- Specified by:
insertBetweenin interfacePathMap.MutablePathMap<T>- 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.
-
insertFrom
public void insertFrom(Object aFrom, String aFromPath)
Same asPathMap.MutablePathMap.insert(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.- Specified by:
insertFromin interfacePathMap.MutablePathMap<T>- 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
public void insertTo(String aToPath, Object aFrom)
Same asPathMap.MutablePathMap.insert(Object)though starting insertion of object's introspected values at the given "path".- Specified by:
insertToin interfacePathMap.MutablePathMap<T>- 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.
-
merge
public void merge(Object aFrom)
Inspects the given object and adds all elements found in the given object in case the targeted path does not exist or points to a null value. E.g. existing path/value pairs are not overwritten. Elements of typeMap,Collectionand arrays are identified and handled as of their type: The path for each value in aMapis appended with its according key. The path for each value in aCollectionor array is appended with its according index of occurrence (in case of aListor 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.- Specified by:
mergein interfacePathMap.MutablePathMap<T>- Parameters:
aFrom- The object which is to be inspected with the therein contained values being added with their according determined paths.
-
mergeBetween
public void mergeBetween(String aToPath, Object aFrom, String aFromPath)
Same asPathMap.MutablePathMap.merge(Object)though starting merging 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".- Specified by:
mergeBetweenin interfacePathMap.MutablePathMap<T>- Parameters:
aToPath- The sub-path where to merge 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.
-
mergeFrom
public void mergeFrom(Object aFrom, String aFromPath)
Same asPathMap.MutablePathMap.merge(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.- Specified by:
mergeFromin interfacePathMap.MutablePathMap<T>- 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.
-
mergeTo
public void mergeTo(String aToPath, Object aFrom)
Same asPathMap.MutablePathMap.merge(Object)though starting merging of object's introspected values at the given "path".- Specified by:
mergeToin interfacePathMap.MutablePathMap<T>- Parameters:
aToPath- The sub-path where to merge 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.
-
withPut
public PathMap.PathMapBuilder<T> withPut(String aKey, T aValue)
Builder method forKeys.MutableValues.put(Object, Object).- Specified by:
withPutin interfaceDictionary.MutableDictionary.DictionaryBuilder<String,T,PathMap.PathMapBuilder<T>>- Parameters:
aKey- the key for the property to be put.aValue- the value for the property to be put.- Returns:
- The implementing instance as of the builder pattern.
-
size
public int size()
Returns the number of data elements contained in the collection.
-
isEmpty
public boolean isEmpty()
-
containsValue
public boolean containsValue(Object value)
This method is defined for the sake ofMapconformity. Tests whether the provided value has a key assigned.- Specified by:
containsValuein interfaceKeys<String,T>- Specified by:
containsValuein interfaceMap<String,T>- Parameters:
value- The value to test if a key references this value.- Returns:
- True in case the given value is referenced by a key.
-
clear
public void clear()
-
keySet
public Set<String> keySet()
Retrieves a collection containing all the keys found in the elements of this collection.
-
values
public Collection<T> values()
Returns aCollectionview of the values related to the contained keys.
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
forEach
public void forEach(BiConsumer<? super String,? super T> action)
-
replaceAll
public void replaceAll(BiFunction<? super String,? super T,? extends T> function)
- Specified by:
replaceAllin interfaceMap<String,T>
-
toType
public <TYPE> TYPE toType(String aFromPath, Class<TYPE> aType)
Creates an instance of the given type filled with thisPathMap's data.- Specified by:
toTypein interfacePathMap<T>- Type Parameters:
TYPE- the generic type if which to create an instance.- Parameters:
aFromPath- The path representing the root from which to take the data for the instance.aType- the type if the instance to be filled with the herein contained data.- Returns:
- the instance initialized with the herein contained data.
-
fromValue
protected void fromValue(String aToPath, Object aObj)
Hook method for intercepting or modifying the process of object introspection.- Parameters:
aToPath- The sub-path where to insert the object's introspected values to.aObj- The object from which the elements are to be added.
-
fromInstance
protected T fromInstance(Object aValue)
Hook method when introspecting an object to help conversion of that object to the target types. By default this methods just tests for assignment conformity as ofClass.isAssignableFrom(Class)with the type retrieved bygetType().- Parameters:
aValue- The value which is to be transformed to the expected type as ofgetType().- Returns:
- The converted type or null if conversion is not possible.
-
toInstance
protected <TYPE> TYPE toInstance(T aValue, Class<TYPE> aType)
Hook method when reconstructing an object, opposite offromInstance(Object), tries to convert the given value to the desired type.- Type Parameters:
TYPE- The type to which to convert to.- Parameters:
aValue- The value to by converted from this instance's type as ofgetType()to the desired type.aType- The type to which to convert to.- Returns:
- The converted type or null if conversion is not possible.
-
-