Class URIPath


  • public final class URIPath
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      URIPath​(java.lang.String path)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String asString()
      Obtain the full path.
      boolean endsWith​(java.lang.String suffix)  
      java.util.Optional<java.lang.String> getPart​(int index)
      Obtain part of the path by index of slashes in the URL.
      int length()  
      URIPath omitFirst()
      Immutable modification, removes first part of the path string.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • URIPath

        public URIPath​(java.lang.String path)
    • Method Detail

      • asString

        public java.lang.String asString()
        Obtain the full path.
        Returns:
        Example: "/target/path/in/url"
      • getPart

        public java.util.Optional<java.lang.String> getPart​(int index)
        Obtain part of the path by index of slashes in the URL.

        Example: "/example/path", 0 returns "example" Example: "/example/path", 1 returns "path" Example: "/example/path", 2 returns empty optional Example: "/example/path/", 2 returns "" Example: "/", 0 returns "" Example: "/", 1 returns empty optional

        Parameters:
        index - Index from root, eg. /0/1/2/3 etc
        Returns:
        part after a '/' in the path,
      • endsWith

        public boolean endsWith​(java.lang.String suffix)
      • omitFirst

        public URIPath omitFirst()
        Immutable modification, removes first part of the path string.

        Example: URIPath "/example/path" return value of omitFirst URIPath is "/path" Example: URIPath "/example" return value of omitFirst URIPath is "/" Example: URIPath "/" return value of omitFirst URIPath is ""

        Returns:
        new URIPath with first part removed.
      • length

        public int length()
      • toString

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