Interface PathMap.MutablePathMap<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 as 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.
      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 as 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.
      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 as insert(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 the putArray(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.mixin.DelimiterAccessor

        getDelimiter
      • Methods inherited from interface org.refcodes.mixin.Dumpable

        toDump, toDump
      • 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.mixin.TypeAccessor

        getType
    • 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 interface Dictionary.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 the putArray(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 a PathMap 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"
        The resulting array when calling PathMap.getArray(String) for the path "/animals/dogs" would contain {"ace", "bandit", "radar", "echo", "snoopy"}. Calling isArray("/animals/dogs") would return true whereas calling isArray("/animals") would return false.
        Parameters:
        aPath - the path
        aValues - 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 interface Keys.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 type Map, Collection and arrays are identified and handled as of their type: The path for each value in a Map is appended with its according key. The path for each value in a Collection or array is appended with its according index of occurrence (in case of a List 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 as 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.
        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 as insert(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 as 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".
        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 to insert(Object).
        Parameters:
        aFrom - The PathMap 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 to insertFrom(Object, String).
        Parameters:
        aFrom - The PathMap 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 to insertTo(String, Object).
        Parameters:
        aToPath - The sub-path where to insert the object's introspected values to.
        aFrom - The PathMap 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 to insert(String, Object, String).
        Parameters:
        aToPath - The sub-path where to insert the object's introspected values to.
        aFrom - The PathMap 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.