Forgot to commit serializer methods for AuthenticationSettings

This commit is contained in:
dankito 2020-10-17 23:03:28 +02:00
parent a72e7d744c
commit 5c4a4a485f
2 changed files with 21 additions and 0 deletions

View File

@ -6,10 +6,18 @@ import kotlin.reflect.KClass
interface ISerializer {
fun serializeObjectToString(obj: Any): String?
fun serializeObject(obj: Any, outputFile: File)
fun <T : Any> deserializeObject(serializedObject: String, objectClass: KClass<T>, vararg genericParameterTypes: KClass<*>): T?
fun <T : Any> deserializeObject(serializedObjectFile: File, objectClass: KClass<T>, vararg genericParameterTypes: KClass<*>): T?
fun <T : Any> deserializeListOr(serializedObject: String, genericListParameterType: KClass<T>,
defaultValue: List<T> = listOf()) : List<T>
fun <T : Any> deserializeListOr(serializedObjectFile: File, genericListParameterType: KClass<T>,
defaultValue: List<T> = listOf()) : List<T>

View File

@ -6,14 +6,27 @@ import kotlin.reflect.KClass
open class NoOpSerializer : ISerializer {
override fun serializeObjectToString(obj: Any): String? {
return null
}
override fun serializeObject(obj: Any, outputFile: File) {
}
override fun <T : Any> deserializeObject(serializedObject: String, objectClass: KClass<T>, vararg genericParameterTypes: KClass<*>): T? {
return null
}
override fun <T : Any> deserializeObject(serializedObjectFile: File, objectClass: KClass<T>, vararg genericParameterTypes: KClass<*>): T? {
return null
}
override fun <T : Any> deserializeListOr(serializedObject: String, genericListParameterType: KClass<T>, defaultValue: List<T>): List<T> {
return defaultValue
}
override fun <T : Any> deserializeListOr(serializedObjectFile: File, genericListParameterType: KClass<T>, defaultValue: List<T>): List<T> {
return defaultValue
}