Constructor and Description |
---|
PathImpl()
Creates a path.
|
Modifier and Type | Method and Description |
---|---|
Path |
createChild(String name)
Creates the specified child for this path and returns it as a new path.
|
boolean |
equals(Object obj) |
String |
getAbsolutePath()
Returns the path as string.
|
Path |
getChildPath()
Returns the path of the child.
|
String |
getFirstElement()
Returns the first element of the path.
|
String |
getLastElement()
Returns the last element of the path.
|
Path |
getParentPath()
Returns the path of the parent.
|
int |
hashCode() |
static Path |
parsePath(String path)
Parses the specified path.
|
public Path getParentPath()
Path
Returns the path of the parent.
If this path is /usr/local
this method will return the path
/usr
.
getParentPath
in interface Path
null
, if the path doesn't have a parent.public Path getChildPath()
Path
Returns the path of the child.
If this path is /usr/local
this method will return the path
/local
.
getChildPath
in interface Path
null
, if the path doesn't have a child.public Path createChild(String name)
Path
Creates the specified child for this path and returns it as a new path.
If this path is /usr
and the name of the child is
local
the returned new path will be /usr/local
.
createChild
in interface Path
name
- The name of the child.public String getFirstElement()
Path
Returns the first element of the path.
getFirstElement
in interface Path
null
, if this path represents
the root path.public String getLastElement()
Path
Returns the last element of the path.
getLastElement
in interface Path
null
, if this path represents
the root path.public String getAbsolutePath()
Path
Returns the path as string.
getAbsolutePath
in interface Path
public static Path parsePath(String path)
Parses the specified path.
path
- The path as string.IllegalArgumentException
- If the path is null
.Copyright © 2015–2019. All rights reserved.