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

commonMain.com.copperleaf.json.pointer.JsonPointer.kt Maven / Gradle / Ivy

There is a newer version: 0.7.0
Show newest version
package com.copperleaf.json.pointer

public data class JsonPointer internal constructor(
    public val tokens: List
) {
    public companion object {
        public fun parse(pointer: String): JsonPointer {
            check(pointer.startsWith("#")) { "$pointer does not represent a URI fragment" }

            val tokens = pointer.tokenizeJsonPointerString()

            check(!tokens.contains("[]")) {
                "JsonPointer cannot contain any array-index placeholders. Use AbstractJsonPointer to represent a pointer " +
                    "that must be reified at runtime with proper array indices."
            }

            return JsonPointer(tokens)
        }
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy