mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-25 15:40:28 +08:00
Improve generated value impl
This commit is contained in:
parent
240253cf21
commit
65cbf6e780
@ -110,7 +110,7 @@ fun genAllValueImpl(): String = buildString {
|
|||||||
): Mutable${number}${collectionName}Value {
|
): Mutable${number}${collectionName}Value {
|
||||||
var internalValue: Mutable${collectionName}<${number}> = default
|
var internalValue: Mutable${collectionName}<${number}> = default
|
||||||
|
|
||||||
val delegt = dynamicMutable${collectionName}{ internalValue }
|
val delegt = dynamicMutable${collectionName} { internalValue }
|
||||||
return object : Mutable${number}${collectionName}Value(), Mutable${collectionName}<${number}> by delegt {
|
return object : Mutable${number}${collectionName}Value(), Mutable${collectionName}<${number}> by delegt {
|
||||||
override var value: Mutable${collectionName}<${number}>
|
override var value: Mutable${collectionName}<${number}>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -128,7 +128,7 @@ fun genAllValueImpl(): String = buildString {
|
|||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): Mutable${collectionName}<${number}> {
|
override fun deserialize(decoder: Decoder): Mutable${collectionName}<${number}> {
|
||||||
return delegate.deserialize(decoder).toMutable${collectionName}().observable {
|
return delegate.deserialize(decoder).toMutable${collectionName}().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,10 @@
|
|||||||
|
|
||||||
package net.mamoe.mirai.console.setting.internal
|
package net.mamoe.mirai.console.setting.internal
|
||||||
|
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.Decoder
|
||||||
|
import kotlinx.serialization.Encoder
|
||||||
|
import kotlinx.serialization.KSerializer
|
||||||
|
import kotlinx.serialization.SerialDescriptor
|
||||||
import kotlinx.serialization.builtins.*
|
import kotlinx.serialization.builtins.*
|
||||||
import net.mamoe.mirai.console.setting.*
|
import net.mamoe.mirai.console.setting.*
|
||||||
|
|
||||||
@ -705,7 +708,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableIntListValue {
|
): MutableIntListValue {
|
||||||
var internalValue: MutableList<Int> = default
|
var internalValue: MutableList<Int> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableList{ internalValue }
|
val delegt = dynamicMutableList { internalValue }
|
||||||
return object : MutableIntListValue(), MutableList<Int> by delegt {
|
return object : MutableIntListValue(), MutableList<Int> by delegt {
|
||||||
override var value: MutableList<Int>
|
override var value: MutableList<Int>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -715,15 +718,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableList<Int>> = object : KSerializer<MutableList<Int>> {
|
override val serializer: KSerializer<MutableList<Int>> = object : KSerializer<MutableList<Int>> {
|
||||||
private val delegate = ListSerializer(Int.serializer())
|
private val delegate = ListSerializer(Int.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableList<Int> {
|
override fun deserialize(decoder: Decoder): MutableList<Int> {
|
||||||
return delegate.deserialize(decoder).toMutableList().observable {
|
return delegate.deserialize(decoder).toMutableList().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -741,7 +744,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableShortListValue {
|
): MutableShortListValue {
|
||||||
var internalValue: MutableList<Short> = default
|
var internalValue: MutableList<Short> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableList{ internalValue }
|
val delegt = dynamicMutableList { internalValue }
|
||||||
return object : MutableShortListValue(), MutableList<Short> by delegt {
|
return object : MutableShortListValue(), MutableList<Short> by delegt {
|
||||||
override var value: MutableList<Short>
|
override var value: MutableList<Short>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -751,15 +754,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableList<Short>> = object : KSerializer<MutableList<Short>> {
|
override val serializer: KSerializer<MutableList<Short>> = object : KSerializer<MutableList<Short>> {
|
||||||
private val delegate = ListSerializer(Short.serializer())
|
private val delegate = ListSerializer(Short.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableList<Short> {
|
override fun deserialize(decoder: Decoder): MutableList<Short> {
|
||||||
return delegate.deserialize(decoder).toMutableList().observable {
|
return delegate.deserialize(decoder).toMutableList().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -777,7 +780,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableByteListValue {
|
): MutableByteListValue {
|
||||||
var internalValue: MutableList<Byte> = default
|
var internalValue: MutableList<Byte> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableList{ internalValue }
|
val delegt = dynamicMutableList { internalValue }
|
||||||
return object : MutableByteListValue(), MutableList<Byte> by delegt {
|
return object : MutableByteListValue(), MutableList<Byte> by delegt {
|
||||||
override var value: MutableList<Byte>
|
override var value: MutableList<Byte>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -787,15 +790,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableList<Byte>> = object : KSerializer<MutableList<Byte>> {
|
override val serializer: KSerializer<MutableList<Byte>> = object : KSerializer<MutableList<Byte>> {
|
||||||
private val delegate = ListSerializer(Byte.serializer())
|
private val delegate = ListSerializer(Byte.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableList<Byte> {
|
override fun deserialize(decoder: Decoder): MutableList<Byte> {
|
||||||
return delegate.deserialize(decoder).toMutableList().observable {
|
return delegate.deserialize(decoder).toMutableList().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -813,7 +816,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableLongListValue {
|
): MutableLongListValue {
|
||||||
var internalValue: MutableList<Long> = default
|
var internalValue: MutableList<Long> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableList{ internalValue }
|
val delegt = dynamicMutableList { internalValue }
|
||||||
return object : MutableLongListValue(), MutableList<Long> by delegt {
|
return object : MutableLongListValue(), MutableList<Long> by delegt {
|
||||||
override var value: MutableList<Long>
|
override var value: MutableList<Long>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -823,15 +826,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableList<Long>> = object : KSerializer<MutableList<Long>> {
|
override val serializer: KSerializer<MutableList<Long>> = object : KSerializer<MutableList<Long>> {
|
||||||
private val delegate = ListSerializer(Long.serializer())
|
private val delegate = ListSerializer(Long.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableList<Long> {
|
override fun deserialize(decoder: Decoder): MutableList<Long> {
|
||||||
return delegate.deserialize(decoder).toMutableList().observable {
|
return delegate.deserialize(decoder).toMutableList().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -849,7 +852,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableFloatListValue {
|
): MutableFloatListValue {
|
||||||
var internalValue: MutableList<Float> = default
|
var internalValue: MutableList<Float> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableList{ internalValue }
|
val delegt = dynamicMutableList { internalValue }
|
||||||
return object : MutableFloatListValue(), MutableList<Float> by delegt {
|
return object : MutableFloatListValue(), MutableList<Float> by delegt {
|
||||||
override var value: MutableList<Float>
|
override var value: MutableList<Float>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -859,15 +862,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableList<Float>> = object : KSerializer<MutableList<Float>> {
|
override val serializer: KSerializer<MutableList<Float>> = object : KSerializer<MutableList<Float>> {
|
||||||
private val delegate = ListSerializer(Float.serializer())
|
private val delegate = ListSerializer(Float.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableList<Float> {
|
override fun deserialize(decoder: Decoder): MutableList<Float> {
|
||||||
return delegate.deserialize(decoder).toMutableList().observable {
|
return delegate.deserialize(decoder).toMutableList().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -885,7 +888,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableDoubleListValue {
|
): MutableDoubleListValue {
|
||||||
var internalValue: MutableList<Double> = default
|
var internalValue: MutableList<Double> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableList{ internalValue }
|
val delegt = dynamicMutableList { internalValue }
|
||||||
return object : MutableDoubleListValue(), MutableList<Double> by delegt {
|
return object : MutableDoubleListValue(), MutableList<Double> by delegt {
|
||||||
override var value: MutableList<Double>
|
override var value: MutableList<Double>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -895,15 +898,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableList<Double>> = object : KSerializer<MutableList<Double>> {
|
override val serializer: KSerializer<MutableList<Double>> = object : KSerializer<MutableList<Double>> {
|
||||||
private val delegate = ListSerializer(Double.serializer())
|
private val delegate = ListSerializer(Double.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableList<Double> {
|
override fun deserialize(decoder: Decoder): MutableList<Double> {
|
||||||
return delegate.deserialize(decoder).toMutableList().observable {
|
return delegate.deserialize(decoder).toMutableList().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -921,7 +924,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableBooleanListValue {
|
): MutableBooleanListValue {
|
||||||
var internalValue: MutableList<Boolean> = default
|
var internalValue: MutableList<Boolean> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableList{ internalValue }
|
val delegt = dynamicMutableList { internalValue }
|
||||||
return object : MutableBooleanListValue(), MutableList<Boolean> by delegt {
|
return object : MutableBooleanListValue(), MutableList<Boolean> by delegt {
|
||||||
override var value: MutableList<Boolean>
|
override var value: MutableList<Boolean>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -931,15 +934,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableList<Boolean>> = object : KSerializer<MutableList<Boolean>> {
|
override val serializer: KSerializer<MutableList<Boolean>> = object : KSerializer<MutableList<Boolean>> {
|
||||||
private val delegate = ListSerializer(Boolean.serializer())
|
private val delegate = ListSerializer(Boolean.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableList<Boolean> {
|
override fun deserialize(decoder: Decoder): MutableList<Boolean> {
|
||||||
return delegate.deserialize(decoder).toMutableList().observable {
|
return delegate.deserialize(decoder).toMutableList().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -957,7 +960,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableCharListValue {
|
): MutableCharListValue {
|
||||||
var internalValue: MutableList<Char> = default
|
var internalValue: MutableList<Char> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableList{ internalValue }
|
val delegt = dynamicMutableList { internalValue }
|
||||||
return object : MutableCharListValue(), MutableList<Char> by delegt {
|
return object : MutableCharListValue(), MutableList<Char> by delegt {
|
||||||
override var value: MutableList<Char>
|
override var value: MutableList<Char>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -967,15 +970,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableList<Char>> = object : KSerializer<MutableList<Char>> {
|
override val serializer: KSerializer<MutableList<Char>> = object : KSerializer<MutableList<Char>> {
|
||||||
private val delegate = ListSerializer(Char.serializer())
|
private val delegate = ListSerializer(Char.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableList<Char> {
|
override fun deserialize(decoder: Decoder): MutableList<Char> {
|
||||||
return delegate.deserialize(decoder).toMutableList().observable {
|
return delegate.deserialize(decoder).toMutableList().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -993,7 +996,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableStringListValue {
|
): MutableStringListValue {
|
||||||
var internalValue: MutableList<String> = default
|
var internalValue: MutableList<String> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableList{ internalValue }
|
val delegt = dynamicMutableList { internalValue }
|
||||||
return object : MutableStringListValue(), MutableList<String> by delegt {
|
return object : MutableStringListValue(), MutableList<String> by delegt {
|
||||||
override var value: MutableList<String>
|
override var value: MutableList<String>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -1003,15 +1006,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableList<String>> = object : KSerializer<MutableList<String>> {
|
override val serializer: KSerializer<MutableList<String>> = object : KSerializer<MutableList<String>> {
|
||||||
private val delegate = ListSerializer(String.serializer())
|
private val delegate = ListSerializer(String.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableList<String> {
|
override fun deserialize(decoder: Decoder): MutableList<String> {
|
||||||
return delegate.deserialize(decoder).toMutableList().observable {
|
return delegate.deserialize(decoder).toMutableList().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1029,7 +1032,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableIntSetValue {
|
): MutableIntSetValue {
|
||||||
var internalValue: MutableSet<Int> = default
|
var internalValue: MutableSet<Int> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableSet{ internalValue }
|
val delegt = dynamicMutableSet { internalValue }
|
||||||
return object : MutableIntSetValue(), MutableSet<Int> by delegt {
|
return object : MutableIntSetValue(), MutableSet<Int> by delegt {
|
||||||
override var value: MutableSet<Int>
|
override var value: MutableSet<Int>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -1039,15 +1042,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableSet<Int>> = object : KSerializer<MutableSet<Int>> {
|
override val serializer: KSerializer<MutableSet<Int>> = object : KSerializer<MutableSet<Int>> {
|
||||||
private val delegate = SetSerializer(Int.serializer())
|
private val delegate = SetSerializer(Int.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableSet<Int> {
|
override fun deserialize(decoder: Decoder): MutableSet<Int> {
|
||||||
return delegate.deserialize(decoder).toMutableSet().observable {
|
return delegate.deserialize(decoder).toMutableSet().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1065,7 +1068,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableShortSetValue {
|
): MutableShortSetValue {
|
||||||
var internalValue: MutableSet<Short> = default
|
var internalValue: MutableSet<Short> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableSet{ internalValue }
|
val delegt = dynamicMutableSet { internalValue }
|
||||||
return object : MutableShortSetValue(), MutableSet<Short> by delegt {
|
return object : MutableShortSetValue(), MutableSet<Short> by delegt {
|
||||||
override var value: MutableSet<Short>
|
override var value: MutableSet<Short>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -1075,15 +1078,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableSet<Short>> = object : KSerializer<MutableSet<Short>> {
|
override val serializer: KSerializer<MutableSet<Short>> = object : KSerializer<MutableSet<Short>> {
|
||||||
private val delegate = SetSerializer(Short.serializer())
|
private val delegate = SetSerializer(Short.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableSet<Short> {
|
override fun deserialize(decoder: Decoder): MutableSet<Short> {
|
||||||
return delegate.deserialize(decoder).toMutableSet().observable {
|
return delegate.deserialize(decoder).toMutableSet().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1101,7 +1104,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableByteSetValue {
|
): MutableByteSetValue {
|
||||||
var internalValue: MutableSet<Byte> = default
|
var internalValue: MutableSet<Byte> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableSet{ internalValue }
|
val delegt = dynamicMutableSet { internalValue }
|
||||||
return object : MutableByteSetValue(), MutableSet<Byte> by delegt {
|
return object : MutableByteSetValue(), MutableSet<Byte> by delegt {
|
||||||
override var value: MutableSet<Byte>
|
override var value: MutableSet<Byte>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -1111,15 +1114,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableSet<Byte>> = object : KSerializer<MutableSet<Byte>> {
|
override val serializer: KSerializer<MutableSet<Byte>> = object : KSerializer<MutableSet<Byte>> {
|
||||||
private val delegate = SetSerializer(Byte.serializer())
|
private val delegate = SetSerializer(Byte.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableSet<Byte> {
|
override fun deserialize(decoder: Decoder): MutableSet<Byte> {
|
||||||
return delegate.deserialize(decoder).toMutableSet().observable {
|
return delegate.deserialize(decoder).toMutableSet().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1137,7 +1140,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableLongSetValue {
|
): MutableLongSetValue {
|
||||||
var internalValue: MutableSet<Long> = default
|
var internalValue: MutableSet<Long> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableSet{ internalValue }
|
val delegt = dynamicMutableSet { internalValue }
|
||||||
return object : MutableLongSetValue(), MutableSet<Long> by delegt {
|
return object : MutableLongSetValue(), MutableSet<Long> by delegt {
|
||||||
override var value: MutableSet<Long>
|
override var value: MutableSet<Long>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -1147,15 +1150,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableSet<Long>> = object : KSerializer<MutableSet<Long>> {
|
override val serializer: KSerializer<MutableSet<Long>> = object : KSerializer<MutableSet<Long>> {
|
||||||
private val delegate = SetSerializer(Long.serializer())
|
private val delegate = SetSerializer(Long.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableSet<Long> {
|
override fun deserialize(decoder: Decoder): MutableSet<Long> {
|
||||||
return delegate.deserialize(decoder).toMutableSet().observable {
|
return delegate.deserialize(decoder).toMutableSet().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1173,7 +1176,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableFloatSetValue {
|
): MutableFloatSetValue {
|
||||||
var internalValue: MutableSet<Float> = default
|
var internalValue: MutableSet<Float> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableSet{ internalValue }
|
val delegt = dynamicMutableSet { internalValue }
|
||||||
return object : MutableFloatSetValue(), MutableSet<Float> by delegt {
|
return object : MutableFloatSetValue(), MutableSet<Float> by delegt {
|
||||||
override var value: MutableSet<Float>
|
override var value: MutableSet<Float>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -1183,15 +1186,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableSet<Float>> = object : KSerializer<MutableSet<Float>> {
|
override val serializer: KSerializer<MutableSet<Float>> = object : KSerializer<MutableSet<Float>> {
|
||||||
private val delegate = SetSerializer(Float.serializer())
|
private val delegate = SetSerializer(Float.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableSet<Float> {
|
override fun deserialize(decoder: Decoder): MutableSet<Float> {
|
||||||
return delegate.deserialize(decoder).toMutableSet().observable {
|
return delegate.deserialize(decoder).toMutableSet().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1209,7 +1212,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableDoubleSetValue {
|
): MutableDoubleSetValue {
|
||||||
var internalValue: MutableSet<Double> = default
|
var internalValue: MutableSet<Double> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableSet{ internalValue }
|
val delegt = dynamicMutableSet { internalValue }
|
||||||
return object : MutableDoubleSetValue(), MutableSet<Double> by delegt {
|
return object : MutableDoubleSetValue(), MutableSet<Double> by delegt {
|
||||||
override var value: MutableSet<Double>
|
override var value: MutableSet<Double>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -1219,15 +1222,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableSet<Double>> = object : KSerializer<MutableSet<Double>> {
|
override val serializer: KSerializer<MutableSet<Double>> = object : KSerializer<MutableSet<Double>> {
|
||||||
private val delegate = SetSerializer(Double.serializer())
|
private val delegate = SetSerializer(Double.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableSet<Double> {
|
override fun deserialize(decoder: Decoder): MutableSet<Double> {
|
||||||
return delegate.deserialize(decoder).toMutableSet().observable {
|
return delegate.deserialize(decoder).toMutableSet().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1245,7 +1248,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableBooleanSetValue {
|
): MutableBooleanSetValue {
|
||||||
var internalValue: MutableSet<Boolean> = default
|
var internalValue: MutableSet<Boolean> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableSet{ internalValue }
|
val delegt = dynamicMutableSet { internalValue }
|
||||||
return object : MutableBooleanSetValue(), MutableSet<Boolean> by delegt {
|
return object : MutableBooleanSetValue(), MutableSet<Boolean> by delegt {
|
||||||
override var value: MutableSet<Boolean>
|
override var value: MutableSet<Boolean>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -1255,15 +1258,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableSet<Boolean>> = object : KSerializer<MutableSet<Boolean>> {
|
override val serializer: KSerializer<MutableSet<Boolean>> = object : KSerializer<MutableSet<Boolean>> {
|
||||||
private val delegate = SetSerializer(Boolean.serializer())
|
private val delegate = SetSerializer(Boolean.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableSet<Boolean> {
|
override fun deserialize(decoder: Decoder): MutableSet<Boolean> {
|
||||||
return delegate.deserialize(decoder).toMutableSet().observable {
|
return delegate.deserialize(decoder).toMutableSet().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1281,7 +1284,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableCharSetValue {
|
): MutableCharSetValue {
|
||||||
var internalValue: MutableSet<Char> = default
|
var internalValue: MutableSet<Char> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableSet{ internalValue }
|
val delegt = dynamicMutableSet { internalValue }
|
||||||
return object : MutableCharSetValue(), MutableSet<Char> by delegt {
|
return object : MutableCharSetValue(), MutableSet<Char> by delegt {
|
||||||
override var value: MutableSet<Char>
|
override var value: MutableSet<Char>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -1291,15 +1294,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableSet<Char>> = object : KSerializer<MutableSet<Char>> {
|
override val serializer: KSerializer<MutableSet<Char>> = object : KSerializer<MutableSet<Char>> {
|
||||||
private val delegate = SetSerializer(Char.serializer())
|
private val delegate = SetSerializer(Char.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableSet<Char> {
|
override fun deserialize(decoder: Decoder): MutableSet<Char> {
|
||||||
return delegate.deserialize(decoder).toMutableSet().observable {
|
return delegate.deserialize(decoder).toMutableSet().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1317,7 +1320,7 @@ internal fun Setting.valueImpl(
|
|||||||
): MutableStringSetValue {
|
): MutableStringSetValue {
|
||||||
var internalValue: MutableSet<String> = default
|
var internalValue: MutableSet<String> = default
|
||||||
|
|
||||||
val delegt = dynamicMutableSet{ internalValue }
|
val delegt = dynamicMutableSet { internalValue }
|
||||||
return object : MutableStringSetValue(), MutableSet<String> by delegt {
|
return object : MutableStringSetValue(), MutableSet<String> by delegt {
|
||||||
override var value: MutableSet<String>
|
override var value: MutableSet<String>
|
||||||
get() = internalValue
|
get() = internalValue
|
||||||
@ -1327,15 +1330,15 @@ internal fun Setting.valueImpl(
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val outerThis get() = this
|
private val outerThis get() = this
|
||||||
|
|
||||||
override val serializer: KSerializer<MutableSet<String>> = object : KSerializer<MutableSet<String>> {
|
override val serializer: KSerializer<MutableSet<String>> = object : KSerializer<MutableSet<String>> {
|
||||||
private val delegate = SetSerializer(String.serializer())
|
private val delegate = SetSerializer(String.serializer())
|
||||||
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
override val descriptor: SerialDescriptor get() = delegate.descriptor
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): MutableSet<String> {
|
override fun deserialize(decoder: Decoder): MutableSet<String> {
|
||||||
return delegate.deserialize(decoder).toMutableSet().observable {
|
return delegate.deserialize(decoder).toMutableSet().observable {
|
||||||
onElementChanged(outerThis)
|
onElementChanged(outerThis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1359,7 +1362,7 @@ internal fun <T : Setting> Setting.valueImpl(default: T): Value<T> {
|
|||||||
onElementChanged(this)
|
onElementChanged(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override val serializer = object : KSerializer<T>{
|
override val serializer = object : KSerializer<T> {
|
||||||
override val descriptor: SerialDescriptor
|
override val descriptor: SerialDescriptor
|
||||||
get() = internalValue.updaterSerializer.descriptor
|
get() = internalValue.updaterSerializer.descriptor
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user