T
- the generic typeorg.refcodes.mixin.DelimiterAccessor
, org.refcodes.mixin.Dumpable
, org.refcodes.mixin.TypeAccessor<T>
, Containable
, Dictionary<String,T>
, Keys<String,T>
, PathMap<T>
public class PathMapImpl<T> extends Object implements PathMap<T>
org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
Dictionary.MutableDictionary<K,V>
Keys.MutableKeys<K,V>, Keys.MutableValues<K,V>
PathMap.MutablePathMap<T>, PathMap.PathMapBuilder<T>
Modifier | Constructor | Description |
---|---|---|
|
PathMapImpl(char aDelimiter,
Class<T> aType) |
Create a
PathMap instance using the provided path delimiter for
the path declarations. |
|
PathMapImpl(Object aObj,
char aDelimiter,
Class<T> aType) |
Creates a
PathMap instance containing the elements as of
PathMap.MutablePathMap.insert(Object) . |
|
PathMapImpl(Object aObj,
Class<T> aType) |
Create a
PathMap instance containing the elements as of
PathMap.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 a
PathMap instance containing the elements as of
PathMap.MutablePathMap.insert(Object) . |
|
PathMapImpl(Object aObj,
String aFromPath,
Class<T> aType) |
Creates a
PathMap instance containing the elements as of
PathMap.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 a
PathMap instance containing the elements as of
PathMap.MutablePathMap.insert(Object) . |
|
PathMapImpl(String aToPath,
Object aObj,
Class<T> aType) |
Create a
PathMap instance containing the elements as of
PathMap.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 a
PathMap instance containing the elements as of
PathMap.MutablePathMap.insert(Object) . |
|
PathMapImpl(String aToPath,
Object aObj,
String aFromPath,
Class<T> aType) |
Creates a
PathMap instance containing the elements as of
PathMap.MutablePathMap.insert(Object) using the default path delimiter
"/" (Delimiter.PATH for the path declarations. |
protected |
PathMapImpl(PathMap<T> aPathMap) |
Create a
PathMap instance from the provided PathMap
instance containing the elements as of
PathMap.MutablePathMap.insert(Object) using the PathMap 's path
delimiter for the path declarations the the type of the PathMap . |
Modifier and Type | Method | Description |
---|---|---|
PathMap<T> |
childrenOf(String aParentPath) |
Gets the children elements of the provided parent's path, excluding the
parent's path.
|
static <T> void |
childrenOf(PathMap<T> aFromPathMap,
String aParentPath,
PathMap.PathMapBuilder<T> aToPathMap) |
Hook method for implementing the
PathMap.childrenOf(String)
method. |
boolean |
containsKey(Object aKey) |
Tests whether there is an element with the given key.
|
boolean |
containsValue(Object aValue) |
This method is defined for the sake of
Map conformity. |
T |
get(Object aKey) |
Retrieves the element assigned to the given key.
|
char |
getDelimiter() |
|
Class<T> |
getType() |
|
boolean |
isEmpty() |
Tests whether the accumulation is empty or not.
|
Set<String> |
keySet() |
Retrieves a collection containing all the keys found in the elements of
this collection.
|
PathMap<T> |
retrieveFrom(String aFromPath) |
|
static <T> void |
retrieveFrom(PathMap<T> aFromPathMap,
String aFromPath,
PathMap.PathMapBuilder<T> aToPathMap) |
Hook method for implementing the
PathMap.retrieveFrom(String)
method. |
PathMap<T> |
retrieveTo(String aToPath) |
|
static <T> void |
retrieveTo(PathMap<T> aFromPathMap,
String aToPath,
PathMap.PathMapBuilder<T> aToPathMap) |
Hook method for implementing the
PathMap.retrieveTo(String)
method. |
int |
size() |
Returns the number of data elements contained in the collection.
|
protected static Object |
toArray(Map<String,?> aMap) |
|
Object |
toDataStructure(String aFromPath) |
Similar to the
PathMap.toMap(String) method, though in case all the keys
of a nested Map instance (applicable to the root Map as
well) represent an array (as of PathMap.getArray( String) ), then an
array is generated where the index of each value in the Map is
represented by the number representation of the Map 's key for
that value. |
static Object |
toDataStructure(PathMap<?> aPathMap,
String aFromPath) |
Hook method for implementing the
PathMap.toDataStructure()
method. |
protected static Map<String,?> |
toMap(Map<String,?> aMap) |
|
protected static Object |
toValue(Object aObj) |
|
Collection<T> |
values() |
Returns a
Collection view of the values related to the contained
keys. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
directories, directories, entries, entries, fromExternalKey, getArray, getArray, getRootPath, hasParentPath, isArray, isArray, isDirectory, isEntry, isRecord, isRootPath, keySet, paths, paths, records, records, retrieve, toDataStructure, toExternalKey, toMap, toMap, toNormalizedPath, toNormalizedPath, toParentPath, toPath
protected PathMapImpl(PathMap<T> aPathMap)
PathMap
instance from the provided PathMap
instance containing the elements as of
PathMap.MutablePathMap.insert(Object)
using the PathMap
's path
delimiter for the path declarations the the type of the PathMap
.aPathMap
- The PathMap
from which the elements are to be
added.public PathMapImpl(char aDelimiter, Class<T> aType)
PathMap
instance using the provided path delimiter for
the path declarations.aDelimiter
- The path delimiter to be used for the path
declarations.aType
- The type of the values being referenced by the paths.public PathMapImpl(Object aObj, Class<T> aType)
PathMap
instance containing the elements as of
PathMap.MutablePathMap.insert(Object)
using the default path delimiter
"/" (Delimiter.PATH
) for the path declarations.aObj
- The object from which the elements are to be added.aType
- The type of the values being referenced by the paths.public PathMapImpl(String aToPath, Object aObj, Class<T> aType)
PathMap
instance containing the elements as of
PathMap.MutablePathMap.insert(Object)
using the default path delimiter
"/" (Delimiter.PATH
) for the path declarations.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.public PathMapImpl(Object aObj, String aFromPath, Class<T> aType)
PathMap
instance containing the elements as of
PathMap.MutablePathMap.insert(Object)
using the default path delimiter
"/" (Delimiter.PATH
) for the path declarations.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.public PathMapImpl(String aToPath, Object aObj, String aFromPath, Class<T> aType)
PathMap
instance containing the elements as of
PathMap.MutablePathMap.insert(Object)
using the default path delimiter
"/" (Delimiter.PATH
for the path declarations.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.public PathMapImpl(Object aObj, char aDelimiter, Class<T> aType)
PathMap
instance containing the elements as of
PathMap.MutablePathMap.insert(Object)
.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.public PathMapImpl(String aToPath, Object aObj, char aDelimiter, Class<T> aType)
PathMap
instance containing the elements as of
PathMap.MutablePathMap.insert(Object)
.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.public PathMapImpl(Object aObj, String aFromPath, char aDelimiter, Class<T> aType)
PathMap
instance containing the elements as of
PathMap.MutablePathMap.insert(Object)
.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.public PathMapImpl(String aToPath, Object aObj, String aFromPath, char aDelimiter, Class<T> aType)
PathMap
instance containing the elements as of
PathMap.MutablePathMap.insert(Object)
.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.public boolean containsKey(Object aKey)
containsKey
in interface Keys<String,T>
aKey
- The key for which to test whether there is an element.public boolean containsValue(Object aValue)
Map
conformity.
Tests whether the provided value has a key assigned.containsValue
in interface Keys<String,T>
aValue
- The value to test if a key references this value.public Set<String> keySet()
public Collection<T> values()
Collection
view of the values related to the contained
keys.values
in interface Keys<String,T>
Collection
view of the values related to the contained
keys.public int size()
size
in interface Containable
public boolean isEmpty()
isEmpty
in interface Containable
public char getDelimiter()
getDelimiter
in interface org.refcodes.mixin.DelimiterAccessor
public PathMap<T> retrieveFrom(String aFromPath)
PathMap
from the elements of this PathMap
found below the "from-path". The sub-paths will be the root paths for the
new PathMap
.
Given we have a value for path "/dog/cat" in the PathMap
and we
call PathMap.retrieveFrom(String)
with "/dog", then the resulting
PathMap
will contain the path "/cat" for that value.retrieveFrom
in interface PathMap<T>
aFromPath
- The path from where to start extracting the paths.PathMap
with the elements below the provided path
which are root elements in the new PathMap
.public PathMap<T> retrieveTo(String aToPath)
PathMap
from this PathMap
's elements with
the paths relocated to the provided "to-path".
Given we have a value for path "/dog/cat" in the PathMap
and we
call PathMap.retrieveTo(String)
with "/animals", then the resulting
PathMap
will contain the path "/animals/dog/cat" for that value.public PathMap<T> childrenOf(String aParentPath)
childrenOf
in interface PathMap<T>
aParentPath
- The path from where to retrieve the children.public Class<T> getType()
getType
in interface org.refcodes.mixin.TypeAccessor<T>
public Object toDataStructure(String aFromPath)
PathMap.toMap(String)
method, though in case all the keys
of a nested Map
instance (applicable to the root Map
as
well) represent an array (as of PathMap.getArray( String)
), then an
array is generated where the index of each value in the Map
is
represented by the number representation of the Map
's key for
that value. The result is a data structure consisting of Map
instances and arrays.toDataStructure
in interface PathMap<T>
aFromPath
- The path below which the PathMap
to be converted
into a data structure.Map
instances and
arrays representing the data below the given path.public static Object toDataStructure(PathMap<?> aPathMap, String aFromPath)
PathMap.toDataStructure()
method.public static <T> void retrieveFrom(PathMap<T> aFromPathMap, String aFromPath, PathMap.PathMapBuilder<T> aToPathMap)
PathMap.retrieveFrom(String)
method.T
- The type of the PathMap
the functionality is to be
applied to.aFromPathMap
- The PathMap
from which to retrieve.aFromPath
- The path from where to start extracting the paths.aToPathMap
- The PathMap.PathMapBuilder
which to put the result in.public static <T> void retrieveTo(PathMap<T> aFromPathMap, String aToPath, PathMap.PathMapBuilder<T> aToPathMap)
PathMap.retrieveTo(String)
method.T
- The type of the PathMap
the functionality is to be
applied to.aFromPathMap
- The PathMap
from which to retrieve.aToPath
- The path where to relocate the paths of this
PathMap
to.aToPathMap
- The PathMap.PathMapBuilder
which to put the result in.public static <T> void childrenOf(PathMap<T> aFromPathMap, String aParentPath, PathMap.PathMapBuilder<T> aToPathMap)
PathMap.childrenOf(String)
method.T
- The type of the PathMap
the functionality is to be
applied to.aFromPathMap
- The PathMap
from which to retrieve.aParentPath
- The path from where to retrieve the children.aToPathMap
- The PathMap.PathMapBuilder
which to put the result in.Copyright © 2018. All rights reserved.