Give DynamicReferenceValue a public constructor for custom extending

This commit is contained in:
Him188 2020-05-22 20:46:42 +08:00
parent 912b2e3464
commit 4bbf6549a7
2 changed files with 4 additions and 1 deletions

View File

@ -264,7 +264,7 @@ sealed class Value<T : Any> : ReadWriteProperty<Setting, T> {
* 只引用这个对象, 而不跟踪其成员.
* 仅适用于基础类型, 用于 mutable list/map 等情况; 或标注了 [Serializable] 的类.
*/
abstract class DynamicReferenceValue<T : Any> internal constructor() : Value<T>()
abstract class DynamicReferenceValue<T : Any> : Value<T>()
"""
)
}

View File

@ -59,6 +59,9 @@ abstract class Setting : SettingImpl() {
override fun toString(): String = yamlForToString.stringify(this.serializer, this)
}
/**
* 用于更新或保存这个 [Value] 的序列化器.
*/
@Suppress("UNCHECKED_CAST")
val <T : Setting> T.serializer: KSerializer<T>
get() = kotlinSerializer as KSerializer<T>