|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gradle.api.file.RelativePath
public class RelativePath
Represents a relative path from some base directory to a file. Used in file copying to represent both a source and target file path when copying files.
RelativePath instances are immutable.
Constructor Summary | |
RelativePath(boolean endsWithFile, String... segments)
Creates a RelativePath. |
Method Summary | |
---|---|
RelativePath
|
append(RelativePath other)
|
RelativePath
|
append(boolean endsWithFile, String... segments)
Appends the given names to the end of this path. |
boolean
|
equals(Object o)
|
File
|
getFile(File baseDir)
|
String
|
getLastName()
|
RelativePath
|
getParent()
Returns the parent of this path. |
String
|
getPathString()
|
String[]
|
getSegments()
|
int
|
hashCode()
|
boolean
|
isFile()
|
static RelativePath
|
parse(boolean isFile, String path)
|
static RelativePath
|
parse(boolean isFile, RelativePath parent, String path)
|
RelativePath
|
plus(RelativePath other)
|
RelativePath
|
prepend(String... segments)
Prepends the given names to the start of this path. |
RelativePath
|
replaceLastName(String name)
|
ListIterator
|
segmentIterator()
|
String
|
toString()
|
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Constructor Detail |
---|
public RelativePath(boolean endsWithFile, String... segments)
endsWithFile
- - if true, the path ends with a file, otherwise a directory
Method Detail |
---|
public RelativePath append(RelativePath other)
Appends the given path to the end of this path.
other
- The path to append
public RelativePath append(boolean endsWithFile, String... segments)
segments
- The names to append.endsWithFile
- when true, the new path refers to a file.
@Override public boolean equals(Object o)
public File getFile(File baseDir)
public String getLastName()
public RelativePath getParent()
public String getPathString()
public String[] getSegments()
@Override public int hashCode()
public boolean isFile()
public static RelativePath parse(boolean isFile, String path)
public static RelativePath parse(boolean isFile, RelativePath parent, String path)
public RelativePath plus(RelativePath other)
Appends the given path to the end of this path.
other
- The path to append
public RelativePath prepend(String... segments)
segments
- The names to prepend
public RelativePath replaceLastName(String name)
Returns a copy of this path, with the last name replaced with the given name.
name
- The name.
public ListIterator segmentIterator()
@Override public String toString()
Gradle API 1.12