Groovy Documentation

org.gradle.api.file
[Java] Class RelativePath

java.lang.Object
  org.gradle.api.file.RelativePath
All Implemented Interfaces:
Serializable

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

RelativePath

public RelativePath(boolean endsWithFile, String... segments)
Creates a RelativePath.
Parameters:
endsWithFile - - if true, the path ends with a file, otherwise a directory


 
Method Detail

append

public RelativePath append(RelativePath other)

Appends the given path to the end of this path.

Parameters:
other - The path to append
Returns:
The new path


append

public RelativePath append(boolean endsWithFile, String... segments)
Appends the given names to the end of this path.
Parameters:
segments - The names to append.
endsWithFile - when true, the new path refers to a file.
Returns:
The new path.


equals

@Override
public boolean equals(Object o)


getFile

public File getFile(File baseDir)


getLastName

public String getLastName()


getParent

public RelativePath getParent()
Returns the parent of this path.
Returns:
The parent of this path, or null if this is the root path.


getPathString

public String getPathString()


getSegments

public String[] getSegments()


hashCode

@Override
public int hashCode()


isFile

public boolean isFile()


parse

public static RelativePath parse(boolean isFile, String path)


parse

public static RelativePath parse(boolean isFile, RelativePath parent, String path)


plus

public RelativePath plus(RelativePath other)

Appends the given path to the end of this path.

Parameters:
other - The path to append
Returns:
The new path


prepend

public RelativePath prepend(String... segments)
Prepends the given names to the start of this path.
Parameters:
segments - The names to prepend
Returns:
The new path.


replaceLastName

public RelativePath replaceLastName(String name)

Returns a copy of this path, with the last name replaced with the given name.

Parameters:
name - The name.
Returns:
The path.


segmentIterator

public ListIterator segmentIterator()


toString

@Override
public String toString()


 

Gradle API 1.12