- java.lang.Object
-
- org.refcodes.struct.PathMapImpl<T>
-
- Type Parameters:
T- the generic type
- All Implemented Interfaces:
org.refcodes.mixin.AnnotatorAccessor,org.refcodes.mixin.DelimiterAccessor,org.refcodes.mixin.Dumpable,org.refcodes.mixin.EmptyAccessor,org.refcodes.mixin.TypeAccessor<T>,Containable,Dictionary<String,T>,Keys<String,T>,PathMap<T>
public class PathMapImpl<T> extends Object implements PathMap<T>
The Class PathMapImpl.
-
-
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.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 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 Modifier Constructor Description PathMapImpl(char aDelimiter, Class<T> aType)Create aPathMapinstance using the provided path delimiter for the path declarations.PathMapImpl(Object aObj, char aDelimiter, Class<T> aType)Creates aPathMapinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).PathMapImpl(Object aObj, Class<T> aType)Create aPathMapinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATH) for the path declarations.PathMapImpl(Object aObj, String aFromPath, char aDelimiter, Class<T> aType)Creates aPathMapinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).PathMapImpl(Object aObj, String aFromPath, Class<T> aType)Creates aPathMapinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATH) for the path declarations.PathMapImpl(String aToPath, Object aObj, char aDelimiter, Class<T> aType)Creates aPathMapinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).PathMapImpl(String aToPath, Object aObj, Class<T> aType)Create aPathMapinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATH) for the path declarations.PathMapImpl(String aToPath, Object aObj, String aFromPath, char aDelimiter, Class<T> aType)Create aPathMapinstance containing the elements as ofPathMap.MutablePathMap.insert(Object).PathMapImpl(String aToPath, Object aObj, String aFromPath, Class<T> aType)Creates aPathMapinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using the default path delimiter "/" (Delimiter.PATHfor the path declarations.protectedPathMapImpl(PathMap<T> aPathMap)Create aPathMapinstance from the providedPathMapinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using thePathMap's path delimiter for the path declarations the the type of thePathMap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(Object aKey)Tests whether there is an element with the given key.booleancontainsValue(Object aValue)This method is defined for the sake ofMapconformity.Tget(Object aKey)Retrieves the element assigned to the given key.chargetAnnotator()chargetDelimiter()Class<T>getType()booleanisEmpty()Set<String>keySet()Retrieves a collection containing all the keys found in the elements of this collection.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.StringtoString()Collection<T>values()Returns aCollectionview of the values related to the contained keys.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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, getArrayOr, getArrayOr, getArrayOr, getArrayOr, getArrayOr, getDir, getDir, getDir, getDir, getDir, getDirAt, getDirAt, getDirAt, getDirAt, getDirAt, getDirAt, getDirIndexes, getDirIndexes, getDirIndexes, getDirIndexes, getDirIndexes, getDirs, getDirs, getDirs, getDirs, getDirs, 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, toType
-
-
-
-
Constructor Detail
-
PathMapImpl
protected PathMapImpl(PathMap<T> aPathMap)
Create aPathMapinstance from the providedPathMapinstance containing the elements as ofPathMap.MutablePathMap.insert(Object)using thePathMap's path delimiter for the path declarations the the type of thePathMap.- Parameters:
aPathMap- ThePathMapfrom which the elements are to be added.
-
PathMapImpl
public PathMapImpl(char aDelimiter, Class<T> aType)Create aPathMapinstance 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.
-
PathMapImpl
public PathMapImpl(Object aObj, Class<T> aType)
Create aPathMapinstance 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.
-
PathMapImpl
public PathMapImpl(String aToPath, Object aObj, Class<T> aType)
Create aPathMapinstance 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.
-
PathMapImpl
public PathMapImpl(Object aObj, String aFromPath, Class<T> aType)
Creates aPathMapinstance 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.
-
PathMapImpl
public PathMapImpl(String aToPath, Object aObj, String aFromPath, Class<T> aType)
Creates aPathMapinstance 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.
-
PathMapImpl
public PathMapImpl(Object aObj, char aDelimiter, Class<T> aType)
Creates aPathMapinstance 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.
-
PathMapImpl
public PathMapImpl(String aToPath, Object aObj, char aDelimiter, Class<T> aType)
Creates aPathMapinstance 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.
-
PathMapImpl
public PathMapImpl(Object aObj, String aFromPath, char aDelimiter, Class<T> aType)
Creates aPathMapinstance 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.
-
PathMapImpl
public PathMapImpl(String aToPath, Object aObj, String aFromPath, char aDelimiter, Class<T> aType)
Create aPathMapinstance 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 aKey)
Tests whether there is an element with the given key.- Specified by:
containsKeyin interfaceKeys<String,T>- Parameters:
aKey- The key for which to test whether there is an element.- Returns:
- True in case there is an element for the given key.
-
containsValue
public boolean containsValue(Object aValue)
This method is defined for the sake ofMapconformity. Tests whether the provided value has a key assigned.- Specified by:
containsValuein interfaceKeys<String,T>- Parameters:
aValue- The value to test if a key references this value.- Returns:
- True in case the given value is referenced by a key.
-
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.- Specified by:
valuesin interfaceKeys<String,T>- Returns:
- A
Collectionview of the values related to the contained keys.
-
size
public int size()
Returns the number of data elements contained in the collection.- Specified by:
sizein interfaceContainable- Returns:
- An integer representing the number of items stored in the accumulation.
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceorg.refcodes.mixin.EmptyAccessor
-
getDelimiter
public char getDelimiter()
- Specified by:
getDelimiterin interfaceorg.refcodes.mixin.DelimiterAccessor
-
getAnnotator
public char getAnnotator()
- Specified by:
getAnnotatorin interfaceorg.refcodes.mixin.AnnotatorAccessor
-
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.
-
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.
-
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.
-
-