Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itsdoot/configurate-serialization
Kotlinx.serialization support for configurate
https://github.com/itsdoot/configurate-serialization
configurate kotlinx-serialization
Last synced: about 1 month ago
JSON representation
Kotlinx.serialization support for configurate
- Host: GitHub
- URL: https://github.com/itsdoot/configurate-serialization
- Owner: ItsDoot
- License: mit
- Created: 2020-04-02T19:03:32.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-01T07:03:08.000Z (about 3 years ago)
- Last Synced: 2023-03-07T00:24:05.371Z (over 1 year ago)
- Topics: configurate, kotlinx-serialization
- Language: Kotlin
- Size: 59.6 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# configurate-serialization
[Kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) support for [configurate](https://github.com/SpongePowered/Configurate).
# Usage
### Gradle
```kotlin
plugins {
kotlin("jvm") version "1.3.71"
kotlin("plugin.serialization") version "1.3.71"
}repositories {
mavenCentral()
maven("https://repo.spongepowered.org/maven")
maven("https://jitpack.io")
}dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0")
implementation("org.spongepowered:configurate-core:3.6")implementation("com.github.ItsDoot:configurate-serialization:0.1.0")
}
```### Example
```kotlin
@Serializable
data class MyConfig(val enabled: Boolean, val limit: Int, val name: String)fun parse(node: ConfigurationNode) {
val config = ConfigurationNodeParser.parse(node, MyConfig.serializer())
println("enabled? ${config.enabled}")
println("limit = ${config.limit}")
println("name = ${config.name}")
}
```