Class PathManager<T>


  • public class PathManager<T>
    extends java.lang.Object
    The path manager helps resolving elements (handlers) for path with variables, e.g. a/{varb}/c. Using getBindings() one can get the concrete variable bindings for a given path/handler.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<T,​java.lang.String> addedpaths
      The exactly added paths of elements.
      protected java.util.List<java.util.Map<java.lang.String,​java.util.Collection<T>>> pathparts
      The list with maps per level.
    • Constructor Summary

      Constructors 
      Constructor Description
      PathManager()
      Create a new info.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPathElement​(java.lang.String path, T elem)
      Adds a new info.
      java.util.Map<java.lang.String,​java.lang.String> getBindingsForPath​(java.lang.String path)
      Get the variable bindings for path variables.
      T getElementForPath​(java.lang.String path)
      Get the element for a path.
      java.util.Collection<T> getElements()
      Get the added elements.
      java.util.Collection<T> getElementsForPath​(java.lang.String path)
      Get the element for a path.
      int getPathDepth​(java.lang.String path)
      Get the path depth of an element.
      int getPathDepth​(T elem)
      Get the path depth of an element.
      java.lang.String getPathForElement​(T elem)
      Get the path for an element.
      protected java.util.Map<java.lang.String,​java.util.Collection<T>> getPathPartMap​(int level, boolean add)
      Get a path part map for a level.
      static void main​(java.lang.String[] args)
      Main for testing.
      void removeElementForPath​(java.lang.String path)  
      int size()
      Get the number of added paths.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pathparts

        protected java.util.List<java.util.Map<java.lang.String,​java.util.Collection<T>>> pathparts
        The list with maps per level. Each level has a map for looking up suitable elements. The results must be cut set.
      • addedpaths

        protected java.util.Map<T,​java.lang.String> addedpaths
        The exactly added paths of elements.
    • Constructor Detail

      • PathManager

        public PathManager()
        Create a new info.
    • Method Detail

      • addPathElement

        public void addPathElement​(java.lang.String path,
                                   T elem)
        Adds a new info.
        Parameters:
        path - The path.
        elem - The element.
      • getElementForPath

        public T getElementForPath​(java.lang.String path)
        Get the element for a path.
        Parameters:
        path - The path.
        Returns:
        The element.
      • getElementsForPath

        public java.util.Collection<T> getElementsForPath​(java.lang.String path)
        Get the element for a path.
        Parameters:
        path - The path.
        Returns:
        The element.
      • removeElementForPath

        public void removeElementForPath​(java.lang.String path)
        Parameters:
        vhost - Virtual host specification.
        path - Path being handled.
      • getBindingsForPath

        public java.util.Map<java.lang.String,​java.lang.String> getBindingsForPath​(java.lang.String path)
        Get the variable bindings for path variables.
        Parameters:
        path - The path.
        Returns:
        The variables for the path.
      • getPathPartMap

        protected java.util.Map<java.lang.String,​java.util.Collection<T>> getPathPartMap​(int level,
                                                                                               boolean add)
        Get a path part map for a level.
        Parameters:
        level - The level.
        Returns:
        The map or null.
      • getPathDepth

        public int getPathDepth​(java.lang.String path)
        Get the path depth of an element.
        Parameters:
        path - The path.
        Returns:
        The path depth.
      • getPathDepth

        public int getPathDepth​(T elem)
        Get the path depth of an element.
        Parameters:
        elem - The element.
        Returns:
        The path depth.
      • getPathForElement

        public java.lang.String getPathForElement​(T elem)
        Get the path for an element.
        Parameters:
        elem - The element.
        Returns:
        The added path.
      • size

        public int size()
        Get the number of added paths.
        Returns:
        The number of added paths.
      • getElements

        public java.util.Collection<T> getElements()
        Get the added elements.
      • main

        public static void main​(java.lang.String[] args)
        Main for testing.