Class Paths.SingleSegmentPath

    • Constructor Detail

      • SingleSegmentPath

        protected SingleSegmentPath​(String segment)
    • Method Detail

      • parent

        public Optional<Path> parent()
        Description copied from interface: Path
        Get the optional parent path.
        Specified by:
        parent in interface Path
        Returns:
        an optional containing the parent (if this is not the root path), or an empty optional if this is the root path.
      • lastSegment

        public Optional<String> lastSegment()
        Description copied from interface: Path
        Get the last segment, if there is one.
        Specified by:
        lastSegment in interface Path
        Returns:
        an optional containing the last segment of this path (if this is not the root path), or an empty optional if this is the root path.
      • size

        public int size()
        Description copied from interface: Path
        Get the number of segments in the path.
        Specified by:
        size in interface Path
        Returns:
        the size of the path; never negative
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toRelativePath

        public String toRelativePath()
        Description copied from interface: Path
        Obtain the representation of this path as a relative path without the leading '/'.
        Specified by:
        toRelativePath in interface Path
        Returns:
        the relative path; never null but may be empty
      • subpath

        public Path subpath​(int length)
        Description copied from interface: Path
        Get a portion of this path that has a specified number of segments.
        Specified by:
        subpath in interface Path
        Parameters:
        length - the number of segments
        Returns:
        the subpath, or this path if the supplied length is equal to this.size()
      • segment

        public String segment​(int index)
        Description copied from interface: Path
        Get the segment at the given index.
        Specified by:
        segment in interface Path
        Parameters:
        index - the index of the segment
        Returns:
        the segment
      • append

        public Path append​(Path relPath)
        Description copied from interface: Path
        Create a new path consisting of this path appended with the given path that will be treated as a relative path.
        Specified by:
        append in interface Path
        Parameters:
        relPath - the relative path to be appended to this path; may not be null
        Returns:
        the new path