All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.copperleaf.ballast.navigation.routing.UnmatchedDestination.kt Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
package com.copperleaf.ballast.navigation.routing

import com.copperleaf.ballast.navigation.internal.Uri

/**
 * Represents a URL that was parsed, and can be used to match against a [Route] in a [RoutingTable].
 */
public data class UnmatchedDestination(
    val originalDestinationUrl: String,

    val matchablePathSegments: List,
    val matchableQueryParameters: Map>,

    public val extraAnnotations: Set,
) {
    public companion object {
        public fun parse(
            destinationUrl: String,
            extraAnnotations: Set = emptySet(),
        ): UnmatchedDestination {
            val url = Uri.parse(destinationUrl)

            return UnmatchedDestination(
                originalDestinationUrl = destinationUrl,
                matchablePathSegments = url.decodedPathSegments,
                matchableQueryParameters = url.decodedQueryParameters,
                extraAnnotations = extraAnnotations,
            )
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy