Class PathSpec

    • Field Detail

      • pathSpec

        protected String pathSpec
      • pathDepth

        protected int pathDepth
      • specLength

        protected int specLength
      • prefix

        protected String prefix
      • suffix

        protected String suffix
    • Constructor Detail

      • PathSpec

        public PathSpec()
    • Method Detail

      • 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 String getPathInfo​(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 String getPathMatch​(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 String getDeclaration()
        The as-provided path spec.
        Returns:
        the as-provided path spec
      • getPrefix

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

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

        public abstract String getRelativePath​(String base,
                                               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 Object
      • matches

        public abstract boolean matches​(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