From 5c4a4a485f44f389198c7330ad0eba40d7037629 Mon Sep 17 00:00:00 2001 From: dankito Date: Sat, 17 Oct 2020 23:03:28 +0200 Subject: [PATCH] Forgot to commit serializer methods for AuthenticationSettings --- .../kotlin/net/dankito/banking/util/ISerializer.kt | 8 ++++++++ .../net/dankito/banking/util/NoOpSerializer.kt | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/util/ISerializer.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/util/ISerializer.kt index 311370d3..7c830805 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/util/ISerializer.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/util/ISerializer.kt @@ -6,10 +6,18 @@ import kotlin.reflect.KClass interface ISerializer { + fun serializeObjectToString(obj: Any): String? + fun serializeObject(obj: Any, outputFile: File) + + fun deserializeObject(serializedObject: String, objectClass: KClass, vararg genericParameterTypes: KClass<*>): T? + fun deserializeObject(serializedObjectFile: File, objectClass: KClass, vararg genericParameterTypes: KClass<*>): T? + fun deserializeListOr(serializedObject: String, genericListParameterType: KClass, + defaultValue: List = listOf()) : List + fun deserializeListOr(serializedObjectFile: File, genericListParameterType: KClass, defaultValue: List = listOf()) : List diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/util/NoOpSerializer.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/util/NoOpSerializer.kt index b0c2bda9..9deffe9d 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/util/NoOpSerializer.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/util/NoOpSerializer.kt @@ -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 deserializeObject(serializedObject: String, objectClass: KClass, vararg genericParameterTypes: KClass<*>): T? { + return null + } + override fun deserializeObject(serializedObjectFile: File, objectClass: KClass, vararg genericParameterTypes: KClass<*>): T? { return null } + override fun deserializeListOr(serializedObject: String, genericListParameterType: KClass, defaultValue: List): List { + return defaultValue + } + override fun deserializeListOr(serializedObjectFile: File, genericListParameterType: KClass, defaultValue: List): List { return defaultValue }