Also BankingPersistenceJson uses now Banking's ISerializer

This commit is contained in:
dankito 2020-07-10 13:59:19 +02:00
parent 8992d902e8
commit f4312c52db
6 changed files with 15 additions and 6 deletions

View File

@ -16,10 +16,10 @@ import net.dankito.banking.LuceneConfig.Companion.UsageFieldName
import net.dankito.banking.ui.model.Customer import net.dankito.banking.ui.model.Customer
import net.dankito.banking.ui.model.AccountTransaction import net.dankito.banking.ui.model.AccountTransaction
import net.dankito.banking.ui.model.BankAccount import net.dankito.banking.ui.model.BankAccount
import net.dankito.banking.util.ISerializer
import net.dankito.banking.util.JacksonJsonSerializer
import net.dankito.utils.lucene.index.DocumentsWriter import net.dankito.utils.lucene.index.DocumentsWriter
import net.dankito.utils.lucene.index.FieldBuilder import net.dankito.utils.lucene.index.FieldBuilder
import net.dankito.utils.serialization.ISerializer
import net.dankito.utils.serialization.JacksonJsonSerializer
import org.apache.lucene.index.IndexableField import org.apache.lucene.index.IndexableField
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.io.File import java.io.File

View File

@ -3,8 +3,8 @@ package net.dankito.banking.persistence
import net.dankito.banking.ui.model.Customer import net.dankito.banking.ui.model.Customer
import net.dankito.banking.ui.model.AccountTransaction import net.dankito.banking.ui.model.AccountTransaction
import net.dankito.banking.ui.model.BankAccount import net.dankito.banking.ui.model.BankAccount
import net.dankito.utils.serialization.ISerializer import net.dankito.banking.util.ISerializer
import net.dankito.utils.serialization.JacksonJsonSerializer import net.dankito.banking.util.JacksonJsonSerializer
import java.io.File import java.io.File

View File

@ -27,8 +27,6 @@ import net.dankito.text.extraction.pdf.PdfBoxAndroidPdfTextExtractor
import net.dankito.text.extraction.pdf.iText2PdfTextExtractor import net.dankito.text.extraction.pdf.iText2PdfTextExtractor
import net.dankito.utils.IThreadPool import net.dankito.utils.IThreadPool
import net.dankito.utils.ThreadPool import net.dankito.utils.ThreadPool
import net.dankito.utils.serialization.ISerializer
import net.dankito.utils.serialization.JacksonJsonSerializer
import net.dankito.utils.web.client.IWebClient import net.dankito.utils.web.client.IWebClient
import net.dankito.utils.web.client.OkHttpWebClient import net.dankito.utils.web.client.OkHttpWebClient
import java.io.File import java.io.File

View File

@ -9,4 +9,7 @@ interface ISerializer {
fun <T> deserializeObject(serializedObjectFile: File, objectClass: Class<T>, vararg genericParameterTypes: Class<*>): T? fun <T> deserializeObject(serializedObjectFile: File, objectClass: Class<T>, vararg genericParameterTypes: Class<*>): T?
fun <T> deserializeListOr(serializedObjectFile: File, genericListParameterType: Class<T>,
defaultValue: List<T> = listOf()) : List<T>
} }

View File

@ -17,4 +17,8 @@ open class JacksonJsonSerializer(
return serializer.deserializeObject(serializedObjectFile, objectClass, *genericParameterTypes) return serializer.deserializeObject(serializedObjectFile, objectClass, *genericParameterTypes)
} }
override fun <T> deserializeListOr(serializedObjectFile: File, genericListParameterType: Class<T>, defaultValue: List<T>): List<T> {
return serializer.deserializeListOr(serializedObjectFile, genericListParameterType, defaultValue)
}
} }

View File

@ -13,4 +13,8 @@ open class NoOpSerializer : ISerializer {
return null return null
} }
override fun <T> deserializeListOr(serializedObjectFile: File, genericListParameterType: Class<T>, defaultValue: List<T>): List<T> {
return defaultValue
}
} }