diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Amount.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Amount.kt index 636b2951..df2cd723 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Amount.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Amount.kt @@ -1,7 +1,5 @@ package net.dankito.banking.fints.model -import net.dankito.utils.multiplatform.BigDecimal - open class Amount( val string: String @@ -15,10 +13,6 @@ open class Amount( internal constructor() : this("") // for object deserializers - open val bigDecimal: BigDecimal - get() = BigDecimal(this.string.replace(',', '.')) - - override fun equals(other: Any?): Boolean { if (this === other) return true if (other !is Amount) return false diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt index 5db73b0c..4bad06e2 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/model/Money.kt @@ -1,7 +1,5 @@ package net.dankito.banking.fints.model -import net.dankito.utils.multiplatform.BigDecimal - open class Money( val amount: Amount, @@ -15,9 +13,6 @@ open class Money( - open val bigDecimal: BigDecimal - get() = amount.bigDecimal - open val displayString: String get() = "$amount $currency" diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/BigDecimal.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/BigDecimal.kt deleted file mode 100644 index 1a07e67a..00000000 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/BigDecimal.kt +++ /dev/null @@ -1,26 +0,0 @@ -package net.dankito.utils.multiplatform - - -expect fun Collection.sum(): BigDecimal - - -expect class BigDecimal { - - companion object { - val Zero: BigDecimal - } - - - constructor(decimal: String) - - constructor(double: Double) - - - val isPositive: Boolean - - - fun negated(): BigDecimal - - fun format(countDecimalPlaces: Int): String - -} \ No newline at end of file diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/CommonExtensions.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/CommonExtensions.kt index 28b59f4e..5b463317 100644 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/CommonExtensions.kt +++ b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/CommonExtensions.kt @@ -2,7 +2,7 @@ package net.dankito.utils.multiplatform val Char.isLowerCase: Boolean - get() = toLowerCase() == this + get() = lowercaseChar() == this val Char.isUpperCase: Boolean get() = isLowerCase == false diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/File.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/File.kt deleted file mode 100644 index 1163974c..00000000 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/File.kt +++ /dev/null @@ -1,23 +0,0 @@ -package net.dankito.utils.multiplatform - - -expect class File(path: String) { - - constructor(folder: File, filename: String) - - - // have to specify it as method as property would conflict with java.io.File's getAbsolutePath - fun getAbsolutePath(): String - - val filename: String - - val fileExtension: String - - val parent: File? - - - fun mkdirs(): Boolean - - fun delete(): Boolean - -} \ No newline at end of file diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/Freezer.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/Freezer.kt deleted file mode 100644 index 7d9a7afd..00000000 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/Freezer.kt +++ /dev/null @@ -1,14 +0,0 @@ -package net.dankito.utils.multiplatform - - -expect class Freezer() { - - companion object { - - fun freeze(obj: T): T - - fun isFrozen(obj: Any): Boolean - - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/ObjectHolder.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/ObjectHolder.kt deleted file mode 100644 index 093646da..00000000 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/ObjectHolder.kt +++ /dev/null @@ -1,12 +0,0 @@ -package net.dankito.utils.multiplatform - - -open class ObjectHolder( - var value: T -) { - - override fun toString(): String { - return value?.toString() ?: "Value is null" - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/Stopwatch.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/Stopwatch.kt deleted file mode 100644 index 48ddd2e6..00000000 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/Stopwatch.kt +++ /dev/null @@ -1,174 +0,0 @@ -package net.dankito.utils.multiplatform - -import net.dankito.utils.multiplatform.log.Logger -import net.dankito.utils.multiplatform.log.LoggerFactory - - -open class Stopwatch(createStarted: Boolean = true) { - - companion object { - private val log = LoggerFactory.getLogger(Stopwatch::class) - - fun measureDuration(task: () -> Unit): Long { - return measureDuration(Stopwatch(), task) - } - - private fun measureDuration(stopwatch: Stopwatch, task: () -> Unit): Long { - task() - - return stopwatch.stop() - } - - fun logDuration(loggedAction: String, task: () -> T): T { - return logDuration(loggedAction, log, task) - } - - fun logDuration(loggedAction: String, logger: Logger, task: () -> T): T { - val stopwatch = Stopwatch() - - val result = task() - - stopwatch.stopAndLog(loggedAction, logger) - - return result - } - - - suspend fun measureDurationSuspendable(task: suspend () -> Unit): Long { - val stopwatch = Stopwatch() - - task() - - return stopwatch.stop() - } - - suspend fun logDurationSuspendable(loggedAction: String, task: suspend () -> T): T { - return logDurationSuspendable(loggedAction, log, task) - } - - suspend fun logDurationSuspendable(loggedAction: String, logger: Logger, task: suspend () -> T): T { - val stopwatch = Stopwatch() - - val result = task() - - stopwatch.stopAndLog(loggedAction, logger) - - return result - } - } - - - constructor() : this(true) - - - var isRunning = false - protected set - - var startedAt = 0L - protected set - - var elapsedNanos = 0L - protected set - - - init { - if (createStarted) { - start() - } - } - - - open fun getCurrentTimeNanoSeconds(): Long { - return Date.nanoSecondsSinceEpoch - } - - open fun start() { - if (isRunning == false) { - startedAt = getCurrentTimeNanoSeconds() - - isRunning = true - } - } - - open fun stop(): Long { - if (isRunning) { - val stoppedAt = getCurrentTimeNanoSeconds() - - isRunning = false - elapsedNanos = stoppedAt - startedAt - } - - return elapsedNanos - } - - open fun stopAndPrint(): String { - stop() - - return formatElapsedTime() - } - - open fun stopAndLog(loggedAction: String): Long { - return stopAndLog(loggedAction, log) - } - - open fun stopAndLog(loggedAction: String, logger: Logger): Long { - stop() - - logElapsedTime(loggedAction, logger) - - return elapsedNanos - } - - -// open fun elapsed(desiredUnit: TimeUnit): Long { -// return desiredUnit.convert(elapsedNanos, TimeUnit.NANOSECONDS) -// } - - - open fun formatElapsedTime(): String { - return formatElapsedTime(elapsedNanos) - } - - protected open fun formatElapsedTime(elapsedNanos: Long): String { - val durationMicroseconds = elapsedNanos / 1000 - - val durationMillis = durationMicroseconds / 1000 - val millis = durationMillis % 1000 - - val durationSeconds = durationMillis / 1000 - val seconds = durationSeconds % 60 - - val minutes = durationSeconds / 60 - - return if (minutes > 0) { - StringHelper.format("%02d:%02d.%03d min", minutes, seconds, millis) - } - else if (seconds > 0) { - StringHelper.format("%02d.%03d s", seconds, millis) - } - else { - StringHelper.format("%02d.%03d ms", millis, (durationMicroseconds % 1000)) - } - } - - open fun logElapsedTime(loggedAction: String) { - logElapsedTime(loggedAction, log) - } - - open fun logElapsedTime(loggedAction: String, logger: Logger) { - val formattedElapsedTime = formatElapsedTime() - - logger.info("$loggedAction took $formattedElapsedTime") - } - - - override fun toString(): String { - if (isRunning) { - val elapsedNanos = getCurrentTimeNanoSeconds() - startedAt - return "Running, ${formatElapsedTime(elapsedNanos)} elapsed" - } - - return "Stopped, ${formatElapsedTime()} elapsed" - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfo.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfo.kt deleted file mode 100644 index dc873010..00000000 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfo.kt +++ /dev/null @@ -1,16 +0,0 @@ -package net.dankito.utils.multiplatform.os - - -open class DeviceInfo( - open val manufacturer: String, - open val deviceModel: String, - open val osName: String, - open val osVersion: String, - open val osArch: String -) { - - override fun toString(): String { - return "$manufacturer $deviceModel: $osName $osVersion" - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfoRetriever.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfoRetriever.kt deleted file mode 100644 index 7d81f112..00000000 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfoRetriever.kt +++ /dev/null @@ -1,8 +0,0 @@ -package net.dankito.utils.multiplatform.os - - -expect class DeviceInfoRetriever actual constructor() { - - fun getDeviceInfo(): DeviceInfo - -} \ No newline at end of file diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/os/Os.kt b/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/os/Os.kt deleted file mode 100644 index 58959f5e..00000000 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/os/Os.kt +++ /dev/null @@ -1,19 +0,0 @@ -package net.dankito.utils.multiplatform.os - - -open class Os(open val osHelper: OsHelper = OsHelper()) { - - open val osType: OsType - get() = osHelper.osType - - - open val isRunningOnJvm: Boolean - get() = osType == OsType.JVM - - open val isRunningOnAndroid: Boolean - get() = osType == OsType.Android - - open val isRunningOniOS: Boolean - get() = osType == OsType.iOS - -} \ No newline at end of file diff --git a/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/BigDecimal.kt b/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/BigDecimal.kt deleted file mode 100644 index af932728..00000000 --- a/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/BigDecimal.kt +++ /dev/null @@ -1,67 +0,0 @@ -package net.dankito.utils.multiplatform - -import platform.Foundation.* - - -fun NSDecimalNumber.toBigDecimal(): BigDecimal { - return BigDecimal(this.stringValue) // TODO: find a better way than double string conversion -} - -actual fun Collection.sum(): BigDecimal { - return this.fold(NSDecimalNumber.zero) { acc, e -> acc.decimalNumberByAdding(e.decimal) }.toBigDecimal() -} - - -actual class BigDecimal(val decimal: NSDecimalNumber) : Comparable { // it's almost impossible to derive from NSDecimalNumber so i keep it as property - - actual companion object { - actual val Zero = BigDecimal(0.0) - } - - actual constructor(double: Double) : this(NSDecimalNumber(double)) - - actual constructor(decimal: String) : this(decimal.toDouble()) - - - actual val isPositive: Boolean - get() = this >= Zero - - - actual fun negated(): BigDecimal { - val negated = decimal.decimalNumberByMultiplyingBy(NSDecimalNumber(1.toULong(), 0, true)) - - return BigDecimal(negated) - } - - actual fun format(countDecimalPlaces: Int): String { - val formatter = NSNumberFormatter() - - formatter.minimumFractionDigits = countDecimalPlaces.toULong() - formatter.maximumFractionDigits = countDecimalPlaces.toULong() - - return formatter.stringFromNumber(this.decimal) ?: "" - } - - - override fun compareTo(other: BigDecimal): Int { - return decimal.compare(other.decimal).toCompareToResult() - } - - override fun equals(other: Any?): Boolean { - if (other is BigDecimal) { - return this.compareTo(other) == 0 - } - - return super.equals(other) - } - - override fun hashCode(): Int { - return decimal.hashCode() - } - - - override fun toString(): String { - return decimal.description ?: decimal.descriptionWithLocale(NSLocale.currentLocale) - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/File.kt b/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/File.kt deleted file mode 100644 index 418962ce..00000000 --- a/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/File.kt +++ /dev/null @@ -1,39 +0,0 @@ -package net.dankito.utils.multiplatform - -import platform.Foundation.* - - -actual class File actual constructor(path: String) : NSURL(fileURLWithPath = path) { - - actual constructor(folder: File, filename: String) - : this(folder.URLByAppendingPathComponent(filename)?.path ?: "") - - - actual fun getAbsolutePath(): String { - return absoluteString ?: absoluteURL?.absoluteString ?: path ?: "" - } - - actual val filename: String - get() = lastPathComponent ?: "" - - actual val fileExtension: String - get() = this.pathExtension ?: filename.substringAfterLast('.', "") - - actual val parent: File? - get() = this.URLByDeletingLastPathComponent?.absoluteString?.let { File(it) } - - - actual fun mkdirs(): Boolean { - return NSFileManager.defaultManager.createDirectoryAtURL(this, true, null, null) - } - - actual fun delete(): Boolean { - return NSFileManager.defaultManager.removeItemAtURL(this, null) - } - - - override fun description(): String? { - return getAbsolutePath() - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/Freezer.kt b/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/Freezer.kt deleted file mode 100644 index c7edba73..00000000 --- a/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/Freezer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package net.dankito.utils.multiplatform - -import kotlin.native.concurrent.freeze -import kotlin.native.concurrent.isFrozen - - -actual class Freezer { - - actual companion object { - - actual fun freeze(obj: T): T { - return obj.freeze() - } - - actual fun isFrozen(obj: Any): Boolean { - return obj.isFrozen - } - - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfoRetriever.kt b/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfoRetriever.kt deleted file mode 100644 index f963eaf9..00000000 --- a/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfoRetriever.kt +++ /dev/null @@ -1,11 +0,0 @@ -package net.dankito.utils.multiplatform.os - - -actual class DeviceInfoRetriever { - - actual fun getDeviceInfo(): DeviceInfo { - // TODO: - return DeviceInfo("", "", "", "", "") - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/BigDecimal.kt b/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/BigDecimal.kt deleted file mode 100644 index 80b03dc8..00000000 --- a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/BigDecimal.kt +++ /dev/null @@ -1,65 +0,0 @@ -package net.dankito.utils.multiplatform - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import net.dankito.utils.multiplatform.serialization.BigDecimalDeserializer - - -fun java.math.BigDecimal.toBigDecimal(): BigDecimal { - return BigDecimal(this.toPlainString()) // TODO: find a better way than double string conversion -} - -actual fun Collection.sum(): BigDecimal { - return this.fold(java.math.BigDecimal.ZERO) { acc, e -> (acc + e) }.toBigDecimal() -} - - -@JsonDeserialize(using = BigDecimalDeserializer::class) -actual class BigDecimal actual constructor(decimal: String) : java.math.BigDecimal(decimal) { - - actual companion object { - actual val Zero = BigDecimal(0.0) - } - - - internal constructor() : this("0") // for object deserializers - - actual constructor(double: Double) : this(java.math.BigDecimal.valueOf(double).toPlainString()) // for object deserializers - - - actual val isPositive: Boolean - get() = this >= ZERO - - - actual fun negated(): BigDecimal { - return BigDecimal(super.negate().toString()) - } - - actual fun format(countDecimalPlaces: Int): String { - return String.format("%.0${countDecimalPlaces}f", this) - } - - - override fun equals(other: Any?): Boolean { - if (other is BigDecimal) { - return this.compareTo(other) == 0 - } - - return super.equals(other) - } - - - /* TODO: where are these methods coming from? */ - - override fun toByte(): Byte { - return 0 // will never be called; where is this method coming from? - } - - override fun toChar(): Char { - return 0.toChar() // will never be called; where is this method coming from? - } - - override fun toShort(): Short { - return 0 // will never be called; where is this method coming from? - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Extensions.kt b/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Extensions.kt deleted file mode 100644 index 0d2f84bf..00000000 --- a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Extensions.kt +++ /dev/null @@ -1,10 +0,0 @@ -package net.dankito.utils.multiplatform - - -fun String?.toFile(): java.io.File? { - return this?.let { File(it) } -} - -fun java.util.Date.toDate(): Date { - return Date(this.time) -} \ No newline at end of file diff --git a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/File.kt b/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/File.kt deleted file mode 100644 index 8b2db6b7..00000000 --- a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/File.kt +++ /dev/null @@ -1,49 +0,0 @@ -package net.dankito.utils.multiplatform - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import net.dankito.utils.multiplatform.serialization.FileDeserializer - - -fun java.io.File.toFile(): File { - return File(this.absolutePath) -} - - -@JsonDeserialize(using = FileDeserializer::class) -actual class File actual constructor(path: String) : java.io.File(path) { - - actual constructor(folder: File, filename: String) - : this(java.io.File(folder, filename).absolutePath) - - - internal constructor() : this("") // for object deserializers - - - actual override fun getAbsolutePath(): String { - return super.getAbsolutePath() - } - - actual val filename: String - get() = super.getName() - - actual val fileExtension: String - get() = this.extension - - actual val parent: File? - get() = this.parentFile?.absolutePath?.let { File(it) } - - - actual override fun mkdirs(): Boolean { - return super.mkdirs() - } - - actual override fun delete(): Boolean { - return super.delete() - } - - - override fun toString(): String { - return absolutePath - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Freezer.kt b/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Freezer.kt deleted file mode 100644 index 72c52a04..00000000 --- a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Freezer.kt +++ /dev/null @@ -1,18 +0,0 @@ -package net.dankito.utils.multiplatform - - -actual class Freezer { - - actual companion object { - - actual fun freeze(obj: T): T { - return obj // no op - } - - actual fun isFrozen(obj: Any): Boolean { - return false // freezing is only possible on Kotlin/Native - } - - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfoRetriever.kt b/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfoRetriever.kt deleted file mode 100644 index 5057aaba..00000000 --- a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/os/DeviceInfoRetriever.kt +++ /dev/null @@ -1,11 +0,0 @@ -package net.dankito.utils.multiplatform.os - - -actual class DeviceInfoRetriever { - - actual fun getDeviceInfo(): DeviceInfo { - // TODO: retrieve manufacturer and device model - return DeviceInfo("", "", System.getProperty("os.name", ""), System.getProperty("os.version", ""), System.getProperty("os.arch", "")) - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/serialization/BigDecimalDeserializer.kt b/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/serialization/BigDecimalDeserializer.kt deleted file mode 100644 index 167b0b4b..00000000 --- a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/serialization/BigDecimalDeserializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package net.dankito.utils.multiplatform.serialization - -import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.databind.DeserializationContext -import com.fasterxml.jackson.databind.deser.std.StdDeserializer -import net.dankito.utils.multiplatform.BigDecimal - - -open class BigDecimalDeserializer : StdDeserializer(BigDecimal::class.java) { - - override fun deserialize(parser: JsonParser, context: DeserializationContext): BigDecimal? { - val doubleString = parser.readValueAs(String::class.java) - - if (doubleString.isNullOrBlank() || doubleString == "null") { - return null - } - - return BigDecimal(doubleString) - } - -} \ No newline at end of file diff --git a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/serialization/FileDeserializer.kt b/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/serialization/FileDeserializer.kt deleted file mode 100644 index 31548681..00000000 --- a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/serialization/FileDeserializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package net.dankito.utils.multiplatform.serialization - -import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.databind.DeserializationContext -import com.fasterxml.jackson.databind.deser.std.StdDeserializer -import net.dankito.utils.multiplatform.File - - -open class FileDeserializer : StdDeserializer(File::class.java) { - - override fun deserialize(parser: JsonParser, context: DeserializationContext): File? { - val path = parser.readValueAs(String::class.java) - - if (path == null || path == "null") { - return null - } - - return File(path) - } - -} \ No newline at end of file