Class StringPath

    • Field Detail

      • ROOT

        public static final StringPath ROOT
        An empty StringPath, i.e. a path with zero components and zero length.
    • Constructor Detail

      • StringPath

        public StringPath​(java.lang.String[] parts)
    • Method Detail

      • getParts

        public java.lang.String[] getParts()
      • of

        public static StringPath of​(java.lang.String... parts)
      • parse

        public static StringPath parse​(java.lang.String value)
        Parameters:
        value - A path to parse, like "path/to/thing". Null will be treated like empty string: both will create a path of zero length.
      • getPathLength

        public int getPathLength()
        Description copied from interface: Path
        Returns the number of elements in the path, which can be retrieved through getPathComponent().
        Specified by:
        getPathLength in interface Path
      • subPath

        public StringPath subPath()
        Returns the path, minus the first element.
      • subPath

        public StringPath subPath​(int start,
                                  int len)
      • getParentPath

        public StringPath getParentPath()
        Returns the parent, or null if at the root level.
        Specified by:
        getParentPath in interface Path
      • getChildPath

        public StringPath getChildPath​(java.lang.String... pathParts)
      • getPathComponent

        public java.lang.String getPathComponent​(int i)
        Description copied from interface: Path
        Returns the path element at the specified location.
        Specified by:
        getPathComponent in interface Path
      • getLastPathComponent

        public java.lang.String getLastPathComponent()
        Description copied from interface: Path
        Convenience function to return the last path element.
        Specified by:
        getLastPathComponent in interface Path
      • isRoot

        public boolean isRoot()
        Returns:
        true if the path length is zero
      • isParentOf

        public boolean isParentOf​(Path child)
      • isAncestorOf

        public boolean isAncestorOf​(Path child)
        Description copied from interface: Path
        Returns whether the provided path is a child path of this one.
        Specified by:
        isAncestorOf in interface Path
      • toString

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

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

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

        public int compareTo​(StringPath that)
        Specified by:
        compareTo in interface java.lang.Comparable<StringPath>