public final class Extended extends java.lang.Object implements Path
Paths that appends path segments to the decorated Path.
Note, the result is automatically normalized, so this can be used to remove path segments, by appending IdempotentEncoded.PARENT.
Examples:
Base path appended path result (empty Path) (empty segment) / (empty Path) . ./ (empty Path) .. ../ (empty Path) a a . (empty segment) ./ or . . . ./ or ./. . .. ../ or ./.. . a a .. (empty segment) ../ or .. .. . ../ or ../. .. .. ../../ .. a ../a / (empty segment) / / . / or /. / .. / or /.. / a /a /a (empty segment) /a/ /a . /a/ or /a/. /a .. / /a b /a/b /a/ (empty segment) /a/ /a/ . /a/ or /a/. /a/ .. / /a/ b /a/b /a/b (empty segment) /a/b/ /a/b . /a/b/ or /a/b/. /a/b .. /a/ /a/b c /a/b/c a (empty segment) a/ a . a/ or a/. a .. ./ a b a/b a/ (empty segment) a/ a/ . a/ or a/. a/ .. ./ a/ b a/b
Note that this is different from the result of Resolved
Extended doesn't remove the last path segment of the base path if it's not a
directoryResolved returns the path reference if it's an absolute path.The following examples illustrate these differences:
new Extended(new StringPath("/a/b"), new StringPath("c/d")); // results in "/a/b/c/d"
new Extended(new StringPath("/a/b"), new StringPath("/c/d")); // results in "/a/b/c/d"
new Resolved(new StringPath("/a/b"), new StringPath("c/d")); // results in "/a/c/d"
new Resolved(new StringPath("/a/b"), new StringPath("/c/d")); // results in "/c/d"
| Constructor and Description |
|---|
Extended(Path delegate,
Path newSegments) |
Extended(Path delegate,
UriEncoded... newSegments) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isAbsolute()
Returns whether this path is absolute, i.e. starts with a "/".
|
boolean |
isEmpty()
Returns whether this path is empty, i.e. contains no path segments.
|
java.util.Iterator<UriEncoded> |
iterator() |
public Extended(Path delegate, UriEncoded... newSegments)
public boolean isEmpty()
Pathpublic boolean isAbsolute()
PathisAbsolute in interface Pathtrue if this path is absolute, false otherwise.public java.util.Iterator<UriEncoded> iterator()
iterator in interface java.lang.Iterable<UriEncoded>