Class PathSpec

  • All Implemented Interfaces:
    java.lang.Comparable<PathSpec>
    Direct Known Subclasses:
    RegexPathSpec, ServletPathSpec

    public abstract class PathSpec
    extends java.lang.Object
    implements java.lang.Comparable<PathSpec>
    The base PathSpec, what all other path specs are based on
    • Constructor Summary

      Constructors 
      Constructor Description
      PathSpec()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(PathSpec other)  
      boolean equals​(java.lang.Object obj)  
      java.lang.String getDeclaration()
      The as-provided path spec.
      PathSpecGroup getGroup()  
      int getPathDepth()
      Get the number of path elements that this path spec declares.
      abstract java.lang.String getPathInfo​(java.lang.String path)
      Return the portion of the path that is after the path spec.
      abstract java.lang.String getPathMatch​(java.lang.String path)
      Return the portion of the path that matches a path spec.
      java.lang.String getPrefix()
      A simple prefix match for the pathspec or null
      abstract java.lang.String getRelativePath​(java.lang.String base, java.lang.String path)
      Get the relative path.
      java.lang.String getSuffix()
      A simple suffix match for the pathspec or null
      int hashCode()  
      abstract boolean matches​(java.lang.String path)
      Test to see if the provided path matches this path spec
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • pathSpec

        protected java.lang.String pathSpec
      • pathDepth

        protected int pathDepth
      • specLength

        protected int specLength
      • prefix

        protected java.lang.String prefix
      • suffix

        protected java.lang.String suffix
    • Constructor Detail

      • PathSpec

        public PathSpec()
    • Method Detail

      • compareTo

        public int compareTo​(PathSpec other)
        Specified by:
        compareTo in interface java.lang.Comparable<PathSpec>
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getPathDepth

        public int getPathDepth()
        Get the number of path elements that this path spec declares.

        This is used to determine longest match logic.

        Returns:
        the depth of the path segments that this spec declares
      • getPathInfo

        public abstract java.lang.String getPathInfo​(java.lang.String path)
        Return the portion of the path that is after the path spec.
        Parameters:
        path - the path to match against
        Returns:
        the path info portion of the string
      • getPathMatch

        public abstract java.lang.String getPathMatch​(java.lang.String path)
        Return the portion of the path that matches a path spec.
        Parameters:
        path - the path to match against
        Returns:
        the match, or null if no match at all
      • getDeclaration

        public java.lang.String getDeclaration()
        The as-provided path spec.
        Returns:
        the as-provided path spec
      • getPrefix

        public java.lang.String getPrefix()
        A simple prefix match for the pathspec or null
        Returns:
        A simple prefix match for the pathspec or null
      • getSuffix

        public java.lang.String getSuffix()
        A simple suffix match for the pathspec or null
        Returns:
        A simple suffix match for the pathspec or null
      • getRelativePath

        public abstract java.lang.String getRelativePath​(java.lang.String base,
                                                         java.lang.String path)
        Get the relative path.
        Parameters:
        base - the base the path is relative to
        path - the additional path
        Returns:
        the base plus path with pathSpec portion removed
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • matches

        public abstract boolean matches​(java.lang.String path)
        Test to see if the provided path matches this path spec
        Parameters:
        path - the path to test
        Returns:
        true if the path matches this path spec, false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object