Class StructureUtility



  • public class StructureUtility
    extends java.lang.Object
    Utility class to avoid redundant code regarding various PathMap implementations.
    • Field Detail

      • IS_PARALLEL_EXPERIMENTAL

        public static boolean IS_PARALLEL_EXPERIMENTAL
        Variable for enabling parallel processing in the PathMap.
    • Method Detail

      • retrieveFrom

        public static <T> void retrieveFrom​(PathMap<T> aFromPathMap,
                                            java.lang.String aFromPath,
                                            PathMap.PathMapBuilder<T> aToPathMap)
        Hook method for implementing the PathMap.retrieveFrom(String) method.
        Type Parameters:
        T - The type of the PathMap the functionality is to be applied to.
        Parameters:
        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.
      • retrieveTo

        public static <T> void retrieveTo​(PathMap<T> aFromPathMap,
                                          java.lang.String aToPath,
                                          PathMap.PathMapBuilder<T> aToPathMap)
        Hook method for implementing the PathMap.retrieveTo(String) method.
        Type Parameters:
        T - The type of the PathMap the functionality is to be applied to.
        Parameters:
        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.
      • toDataStructure

        public static java.lang.Object toDataStructure​(PathMap<?> aPathMap,
                                                       java.lang.String aFromPath)
        Hook method for implementing the PathMap.toDataStructure() method.
        Parameters:
        aPathMap - The PathMap from which to get the data structure.
        aFromPath - The path below which the PathMap to be converted into a data structure.
        Returns:
        A data structure being a mixture of Map instances and arrays representing the data below the given path.
      • toGenericPath

        public static java.lang.String toGenericPath​(PathMap<?> aPathMap,
                                                     java.lang.String aPath)
        Normalizes the path as of PathMap.toNormalizedPath(String) and unifies it so that a path never ends with a delimiter (DelimiterAccessor.getDelimiter()). This is necessary as the root path is represented just by the delimiter, meaning that it also ends with the delimiter, though generic operations may require that a path must not end with the delimiter. This means that the root path is an empty String.
        Parameters:
        aPathMap - The PathMap for which to unify the path.
        aPath - The path to be unified.
        Returns:
        The resulting generic path never ending with a delimiter.