
commonMain.at.asitplus.jsonpath.JsonPathFunctionExtensionMapRepository.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsonpath4k-jvm Show documentation
Show all versions of jsonpath4k-jvm Show documentation
Kotlin Multiplatform library for using Json Paths as specified in [RFC9535](https://datatracker.ietf.org/doc/rfc9535/)
The newest version!
package at.asitplus.jsonpath
import at.asitplus.jsonpath.core.JsonPathFunctionExtension
internal class JsonPathFunctionExtensionMapRepository(
private val extensions: MutableMap> = mutableMapOf()
) : JsonPathFunctionExtensionRepository {
override fun addExtension(
name: String,
extension: () -> JsonPathFunctionExtension<*>
) {
extensions[name]?.let {
throw FunctionExtensionCollisionException(
"A function extension with the name \"$name\" has already been added: $it"
)
}
extensions[name] = extension()
}
override fun getExtension(name: String): JsonPathFunctionExtension<*>? = extensions[name]
override fun export(): Map> = extensions.toMap()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy