Package org.refcodes.structure
Interface CanonicalMap
-
- All Superinterfaces:
Containable
,org.refcodes.mixin.DelimiterAccessor
,Dictionary<java.lang.String,java.lang.String>
,org.refcodes.mixin.Dumpable
,Keys<java.lang.String,java.lang.String>
,PathMap<java.lang.String>
,PropertiesAccessorMixin
,org.refcodes.mixin.TypeAccessor<java.lang.String>
- All Known Subinterfaces:
CanonicalMap.CanonicalMapBuilder
,CanonicalMap.MutableCanonicalMap
- All Known Implementing Classes:
CanonicalMapBuilderImpl
,CanonicalMapImpl
public interface CanonicalMap extends PathMap<java.lang.String>, PropertiesAccessorMixin
TheCanonicalMap
is an "intermediate" type adding type and Data-Structure related functionality to any implementing class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
CanonicalMap.CanonicalMapBuilder
The Interface CanonicalMapBuilder.static interface
CanonicalMap.MutableCanonicalMap
The Interface MutableCanonicalMap.-
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.Keys
Keys.MutableKeys<K,V>, Keys.MutableValues<K,V>
-
Nested classes/interfaces inherited from interface org.refcodes.structure.PathMap
PathMap.MutablePathMap<T>, PathMap.PathMapBuilder<T>
-
Nested classes/interfaces inherited from interface org.refcodes.structure.PropertiesAccessorMixin
PropertiesAccessorMixin.PropertiesBuilderMixin<T>, PropertiesAccessorMixin.PropertiesMixin, PropertiesAccessorMixin.PropertiesMutatorMixin
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_COMMENT
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CanonicalMap
childrenOf(java.lang.String aParentPath)
Gets the children elements of the provided parent's path, excluding the parent's path.default boolean
containsValue(java.lang.Object value)
This method is defined for the sake ofMap
conformity.default CanonicalMap
retrieve(java.lang.String aFromPath, java.lang.String aToPath)
CanonicalMap
retrieveFrom(java.lang.String aFromPath)
CanonicalMap
retrieveTo(java.lang.String aToPath)
default <T> void
toInstance(java.lang.String aFromPath, T aInstance)
Updates the instance with thisCanonicalMap
's data.default <T> void
toInstance(T aInstance)
Updates the instance with thisCanonicalMap
's data.default <T> T
toType(java.lang.Class<T> aType)
Creates an instance of the given type filled with thisCanonicalMap
's data.default <T> T
toType(java.lang.String aFromPath, java.lang.Class<T> aType)
Creates an instance of the given type filled with thisCanonicalMap
's data.-
Methods inherited from interface org.refcodes.structure.Containable
isEmpty, size
-
Methods inherited from interface org.refcodes.structure.Keys
containsKey, get, get, keySet, use, values
-
Methods inherited from interface org.refcodes.structure.PathMap
directories, directories, entries, entries, fromExternalKey, getArray, getArray, getRootPath, hasParentPath, isArray, isArray, isDirectory, isEntry, isRecord, isRootPath, keySet, paths, paths, records, records, toDataStructure, toDataStructure, toExternalKey, toMap, toMap, toNormalizedPath, toNormalizedPath, toParentPath, toPath
-
Methods inherited from interface org.refcodes.structure.PropertiesAccessorMixin
containsKey, get, getBoolean, getBoolean, getByte, getByte, getCharacter, getCharacter, getDouble, getDouble, getFloat, getFloat, getInteger, getInteger, getLong, getLong, getShort, getShort, use, useBoolean, useBoolean, useByte, useByte, useDouble, useDouble, useFloat, useFloat, useInteger, useInteger, useLong, useLong, useShort, useShort
-
-
-
-
Method Detail
-
toType
default <T> T toType(java.lang.Class<T> aType)
Creates an instance of the given type filled with thisCanonicalMap
's data.- Type Parameters:
T
- the generic type if which to create an instance.- Parameters:
aType
- the type if the instance to be filled with the herein contained data.- Returns:
- the instance initialized with the herein contained data.
-
toType
default <T> T toType(java.lang.String aFromPath, java.lang.Class<T> aType)
Creates an instance of the given type filled with thisCanonicalMap
's data.- Type Parameters:
T
- 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.
-
toInstance
default <T> void toInstance(T aInstance)
Updates the instance with thisCanonicalMap
's data. Instances inside the instance may not be updated!- Type Parameters:
T
- the generic type if which to create an instance.- Parameters:
aInstance
- The instance to be updated with the herein contained data.
-
toInstance
default <T> void toInstance(java.lang.String aFromPath, T aInstance)
Updates the instance with thisCanonicalMap
's data. Instances inside the instance may not be updated!- Type Parameters:
T
- 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.aInstance
- The instance to be updated with the herein contained data.
-
containsValue
default boolean containsValue(java.lang.Object value)
This method is defined for the sake ofMap
conformity. Tests whether the provided value has a key assigned.- Specified by:
containsValue
in interfaceKeys<java.lang.String,java.lang.String>
- Parameters:
value
- The value to test if a key references this value.- Returns:
- True in case the given value is referenced by a key.
-
retrieveFrom
CanonicalMap retrieveFrom(java.lang.String aFromPath)
Extracts a newPathMap
from the elements of thisPathMap
found 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 thePathMap
and we callPathMap.retrieveFrom(String)
with "/dog", then the resultingPathMap
will contain the path "/cat" for that value.- Specified by:
retrieveFrom
in interfacePathMap<java.lang.String>
- Parameters:
aFromPath
- The path from where to start extracting the paths.- Returns:
- The
PathMap
with the elements below the provided path which are root elements in the newPathMap
.
-
retrieveTo
CanonicalMap retrieveTo(java.lang.String aToPath)
Extracts a newPathMap
from thisPathMap
's elements with the paths relocated to the provided "to-path". Given we have a value for path "/dog/cat" in thePathMap
and we callPathMap.retrieveTo(String)
with "/animals", then the resultingPathMap
will contain the path "/animals/dog/cat" for that value.- Specified by:
retrieveTo
in interfacePathMap<java.lang.String>
- Parameters:
aToPath
- The path where to relocate the paths of thisPathMap
to.- Returns:
- The
PathMap
with the elements from the providedPathMap
with accordingly relocated paths.
-
childrenOf
CanonicalMap childrenOf(java.lang.String aParentPath)
Gets the children elements of the provided parent's path, excluding the parent's path.- Specified by:
childrenOf
in interfacePathMap<java.lang.String>
- Parameters:
aParentPath
- The path from where to retrieve the children.- Returns:
- The children of the given parent's path.
-
retrieve
default CanonicalMap retrieve(java.lang.String aFromPath, java.lang.String aToPath)
Extracts a newPathMap
from the elements of thisPathMap
found below the "from-path". The sub-paths will be relocated to the provided "to-path".- Specified by:
retrieve
in interfacePathMap<java.lang.String>
- Parameters:
aFromPath
- The path from where to start extracting the paths.aToPath
- The path where to relocate the extracted paths to.- Returns:
- The
PathMap
with the elements below the provided path "from-path" relocated to the given "to-path".
-
-