- java.lang.Object
-
- net.sourceforge.urin.Path<T>
-
- All Implemented Interfaces:
java.lang.Iterable<Segment<T>>
- Direct Known Subclasses:
AbsolutePath
public abstract class Path<T> extends java.lang.Object implements java.lang.Iterable<Segment<T>>
An iterable ofSegment
s.Path
s can either be absolute (starting with '/'), or rootless (not starting with '/').Immutable and thread safe.
- See Also:
- RFC 3986 - Path
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
isAbsolute()
Indicates whether this path is absolute (begins with '/') or not.static <ENCODES> AbsolutePath<ENCODES>
path()
Factory method for creating an emptyAbsolutePath
.static <ENCODES> AbsolutePath<ENCODES>
path(java.lang.Iterable<Segment<ENCODES>> segments)
Factory method for creatingAbsolutePath
s from anIterable
ofSegment
s.static AbsolutePath<java.lang.String>
path(java.lang.String firstSegment, java.lang.String... segments)
Factory method for creatingAbsolutePath
s fromString
s.static <ENCODES> AbsolutePath<ENCODES>
path(Segment<ENCODES>... segments)
Factory method for creatingAbsolutePath
s fromSegment
s.static <ENCODES> Path<ENCODES>
rootlessPath()
Factory method for creating empty rootlessPath
s.static <ENCODES> Path<ENCODES>
rootlessPath(java.lang.Iterable<Segment<ENCODES>> segments)
Factory method for creating rootlessPath
s from anIterable
ofSegment
s.static Path<java.lang.String>
rootlessPath(java.lang.String firstSegment, java.lang.String... segments)
Factory method for creating rootlessPath
s fromString
s.static <ENCODES> Path<ENCODES>
rootlessPath(Segment<ENCODES>... segments)
Factory method for creating rootlessPath
s fromSegment
s.abstract java.util.List<Segment<T>>
segments()
Returns the list ofSegment
s that this path represents.
-
-
-
Method Detail
-
rootlessPath
public static Path<java.lang.String> rootlessPath(java.lang.String firstSegment, java.lang.String... segments)
Factory method for creating rootlessPath
s fromString
s.- Parameters:
firstSegment
- aString
representing the first segment.segments
- any further segments.- Returns:
- a
Path
representing the givenString
s.
-
rootlessPath
public static <ENCODES> Path<ENCODES> rootlessPath()
Factory method for creating empty rootlessPath
s.- Type Parameters:
ENCODES
- The type of value represented by the path segments -String
in the general case.- Returns:
- an empty
Path
.
-
rootlessPath
@SafeVarargs public static <ENCODES> Path<ENCODES> rootlessPath(Segment<ENCODES>... segments)
Factory method for creating rootlessPath
s fromSegment
s.- Type Parameters:
ENCODES
- The type of value represented by the path segments -String
in the general case.- Parameters:
segments
-Segment
s that will be represented by thisPath
.- Returns:
- a
Path
representing the givenSegment
s.
-
rootlessPath
public static <ENCODES> Path<ENCODES> rootlessPath(java.lang.Iterable<Segment<ENCODES>> segments)
Factory method for creating rootlessPath
s from anIterable
ofSegment
s.- Type Parameters:
ENCODES
- The type of value represented by the path segments -String
in the general case.- Parameters:
segments
-Iterable
ofSegment
s that will be represented by thisPath
.- Returns:
- a
Path
representing the givenSegment
s.
-
path
public static AbsolutePath<java.lang.String> path(java.lang.String firstSegment, java.lang.String... segments)
Factory method for creatingAbsolutePath
s fromString
s.- Parameters:
firstSegment
- aString
representing the first segment.segments
- any further segments.- Returns:
- a
AbsolutePath
representing the givenString
s.
-
path
public static <ENCODES> AbsolutePath<ENCODES> path()
Factory method for creating an emptyAbsolutePath
.- Type Parameters:
ENCODES
- The type of value represented by the path segments -String
in the general case.- Returns:
- an empty
AbsolutePath
.
-
path
@SafeVarargs public static <ENCODES> AbsolutePath<ENCODES> path(Segment<ENCODES>... segments)
Factory method for creatingAbsolutePath
s fromSegment
s.- Type Parameters:
ENCODES
- The type of value represented by the path segments -String
in the general case.- Parameters:
segments
-Segment
s that will be represented by thisAbsolutePath
.- Returns:
- a
AbsolutePath
representing the givenSegment
s.
-
path
public static <ENCODES> AbsolutePath<ENCODES> path(java.lang.Iterable<Segment<ENCODES>> segments)
Factory method for creatingAbsolutePath
s from anIterable
ofSegment
s.- Type Parameters:
ENCODES
- The type of value represented by the path segments -String
in the general case.- Parameters:
segments
-Iterable
ofSegment
s that will be represented by thisAbsolutePath
.- Returns:
- a
AbsolutePath
representing the givenSegment
s.
-
isAbsolute
public abstract boolean isAbsolute()
Indicates whether this path is absolute (begins with '/') or not.- Returns:
- whether this path is absolute (begins with '/') or not.
-
-