AbsolutePath

Representation of an absolute path as a subtype of Path and as a list of absolute path fragments. Absolute paths are always "resolved" (i.e. they contain no unnecessary fragments such as current path fragments or consecutive recursive wildcard fragments).

Absolute paths represent locations of data from a root location: e.g. the location of a value within a value where the outer value is seen as the "root" value.

Unlike regular paths, the root fragment is always implicit in absolute paths and is not visible in the list of fragments.

Constructors

Link copied to clipboard
constructor(fragments: List<AbsolutePathFragment> = emptyList())

Creates an absolute path from a list of fragments.

constructor(path: Path)

Creates an absolute path from a path path. The path will be resolved against the root path.

constructor(stringPath: String)

Creates an absolute path from a string representation of a path stringPath. The string will first be converted into a path and then resolved against the root path.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
object Serializer : KSerializer<AbsolutePath>

Absolute path serialiser, serialising absolute paths as strings.

Properties

Link copied to clipboard
open override val fragments: List<AbsolutePathFragment>

List of fragments representing this path.

Link copied to clipboard

Whether this path represents the root path.

Link copied to clipboard

Last fragment of this path or null for the root path.

Link copied to clipboard
val size: Int

Size of the path (number of fragments it has).

Functions

Link copied to clipboard
fun append(vararg fragments: AbsolutePathFragment): AbsolutePath

Returns the absolute path resulting from appending fragments to this path.

fun append(vararg fragments: PathFragment): Path

Returns the path resulting from appending fragments to this path.

Link copied to clipboard
operator fun contains(path: Path): Boolean

Returns whether this path contains path. Note that path will be converted to an absolute path when it isn't one.

Link copied to clipboard
suspend fun <T> Path.convertTableRowIdsToIndices(formSchema: Schema<T>, formValue: T): AbsolutePath

Utility function which converts a path where table rows are indexed by their id into a path where said rows are indexed by their index in the corresponding table within the provided form value formValue (with schema formSchema).

Link copied to clipboard
suspend fun <T> Path.convertTableRowIndicesToIds(formSchema: Schema<T>, formValue: T): AbsolutePath

Utility function which converts a path where table rows are indexed by their index into a path where said rows are indexed by their id in the corresponding table within the provided form value formValue (with schema formSchema).

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Returns whether this path equals other.

Link copied to clipboard
open override fun fragment(index: Int): AbsolutePathFragment

Returns the fragment of this path with index index.

Link copied to clipboard
open operator override fun get(index: Int): AbsolutePathFragment

Returns the fragment of this path with index index.

Link copied to clipboard

Returns whether this path has at least one wildcard (either recursive or not).

Link copied to clipboard
open override fun hashCode(): Int

Returns the hash code for this path.

Link copied to clipboard

Returns whether this path has at least one recursive wildcard.

Link copied to clipboard

Returns whether this path has at least one non-recursive wildcard.

Link copied to clipboard
open operator override fun iterator(): Iterator<AbsolutePathFragment>

Returns an iterator over the path's fragments.

Link copied to clipboard
fun join(vararg stringPaths: String): Path

Returns the path resulting from joining the provided paths in string notation stringPaths together with this path.

fun join(vararg paths: Path): Path

Returns the path resulting from joining paths together with this path.

Link copied to clipboard
fun matches(path: Path): Boolean

Returns whether this path matches with path. Note that path will be converted to an absolute path when it isn't one.

Link copied to clipboard
open override fun parent(): AbsolutePath

Returns an absolute path representing the parent of this path. Equivalent to resolve("..").

Link copied to clipboard
open operator override fun plus(stringPath: String): AbsolutePath

Returns the absolute path resulting from resolving the path in string notation stringPath against this path. Equivalent to resolve(stringPath).

operator fun plus(fragment: AbsolutePathFragment): AbsolutePath

Returns the absolute path resulting from appending fragment to this path.

open operator override fun plus(path: Path): AbsolutePath

Returns the absolute path resulting from resolving path against this path. Equivalent to resolve(path).

operator fun plus(fragment: PathFragment): Path

Returns the path resulting from appending fragment to this path. Equivalent to append(fragment).

Link copied to clipboard
fun relativeTo(path: Path): Path

Returns a relative path representing this path, but relative to path. Note that path will be converted to an absolute path when it isn't one.

Link copied to clipboard
open override fun resolve(vararg stringPaths: String): AbsolutePath

Returns the absolute path resulting from resolving a list of paths in string notation stringPaths against this path.

open override fun resolve(vararg paths: Path): AbsolutePath

Returns the absolute path resulting from resolving a list of paths against this path.

fun resolve(): Path

Returns the result of resolving this path. Resolving the path removes unnecessary fragments such as the current path fragment.

Link copied to clipboard

Converts the receiver path into an absolute path, if it wasn't one already.

Link copied to clipboard
open override fun toString(): String

Returns the path in string notation.