Groovy Documentation

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

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.

Authors:
Steve Appling


Constructor Summary
RelativePath(boolean endsWithFile, java.lang.String segments)

Creates a RelativePath.

 
Method Summary
RelativePath append(RelativePath other)

Appends the given path to the end of this path.

RelativePath append(boolean endsWithFile, java.lang.String segments)

Appends the given names to the end of this path.

boolean equals(java.lang.Object o)

java.io.File getFile(java.io.File baseDir)

java.lang.String getLastName()

RelativePath getParent()

Returns the parent of this path.

java.lang.String getPathString()

String[] getSegments()

int hashCode()

boolean isFile()

static RelativePath parse(boolean isFile, java.lang.String path)

static RelativePath parse(boolean isFile, RelativePath parent, java.lang.String path)

RelativePath plus(RelativePath other)

Appends the given path to the end of this path.

RelativePath prepend(java.lang.String segments)

Prepends the given names to the start of this path.

RelativePath replaceLastName(java.lang.String name)

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

java.util.ListIterator segmentIterator()

java.lang.String toString()

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

RelativePath

public RelativePath(boolean endsWithFile, java.lang.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, java.lang.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(java.lang.Object o)


getFile

public java.io.File getFile(java.io.File baseDir)


getLastName

public java.lang.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 java.lang.String getPathString()


getSegments

public String[] getSegments()


hashCode

@Override
public int hashCode()


isFile

public boolean isFile()


parse

public static RelativePath parse(boolean isFile, java.lang.String path)


parse

public static RelativePath parse(boolean isFile, RelativePath parent, java.lang.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(java.lang.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(java.lang.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 java.util.ListIterator segmentIterator()


toString

@Override
public java.lang.String toString()


 

Groovy Documentation