Moved all extensions to package 'extensions' and grouped them by class

This commit is contained in:
dankito 2022-02-12 13:52:45 +01:00
parent fe69174db9
commit 9746e419d1
9 changed files with 46 additions and 30 deletions

View File

@ -4,14 +4,13 @@ import net.dankito.banking.fints.messages.MessageBuilder
import net.dankito.banking.fints.messages.MessageBuilderResult import net.dankito.banking.fints.messages.MessageBuilderResult
import net.dankito.banking.fints.model.* import net.dankito.banking.fints.model.*
import net.dankito.banking.fints.response.BankResponse import net.dankito.banking.fints.response.BankResponse
import net.dankito.banking.fints.response.ResponseParser
import net.dankito.banking.fints.response.segments.TanResponse import net.dankito.banking.fints.response.segments.TanResponse
import net.dankito.banking.fints.util.IBase64Service import net.dankito.banking.fints.util.IBase64Service
import net.dankito.banking.fints.util.PureKotlinBase64Service import net.dankito.banking.fints.util.PureKotlinBase64Service
import net.dankito.banking.fints.webclient.IWebClient import net.dankito.banking.fints.webclient.IWebClient
import net.dankito.banking.fints.webclient.KtorWebClient import net.dankito.banking.fints.webclient.KtorWebClient
import net.dankito.banking.fints.webclient.WebClientResponse import net.dankito.banking.fints.webclient.WebClientResponse
import net.dankito.utils.multiplatform.getAllExceptionMessagesJoined import net.dankito.utils.multiplatform.extensions.getAllExceptionMessagesJoined
import net.dankito.utils.multiplatform.log.LoggerFactory import net.dankito.utils.multiplatform.log.LoggerFactory

View File

@ -5,10 +5,9 @@ import net.dankito.banking.fints.model.MessageLogEntry
import net.dankito.banking.fints.model.MessageLogEntryType import net.dankito.banking.fints.model.MessageLogEntryType
import net.dankito.utils.multiplatform.log.Logger import net.dankito.utils.multiplatform.log.Logger
import net.dankito.utils.multiplatform.log.LoggerFactory import net.dankito.utils.multiplatform.log.LoggerFactory
import net.dankito.utils.multiplatform.Date
import net.dankito.utils.multiplatform.StackTraceHelper import net.dankito.utils.multiplatform.StackTraceHelper
import net.dankito.utils.multiplatform.StringHelper import net.dankito.utils.multiplatform.extensions.format
import net.dankito.utils.multiplatform.getInnerException import net.dankito.utils.multiplatform.extensions.getInnerException
import kotlin.reflect.KClass import kotlin.reflect.KClass
@ -81,7 +80,7 @@ open class MessageLogCollector {
} }
protected open fun twoDigits(number: Int): String { protected open fun twoDigits(number: Int): String {
return StringHelper.format("%02d", number) return number.format("%02d")
} }
protected open fun getMessageTypeString(type: MessageLogEntryType): String { protected open fun getMessageTypeString(type: MessageLogEntryType): String {

View File

@ -21,7 +21,7 @@ import net.dankito.banking.fints.model.Money
import net.dankito.banking.fints.response.segments.* import net.dankito.banking.fints.response.segments.*
import net.dankito.banking.fints.util.MessageUtils import net.dankito.banking.fints.util.MessageUtils
import net.dankito.utils.multiplatform.Date import net.dankito.utils.multiplatform.Date
import net.dankito.utils.multiplatform.getAllExceptionMessagesJoined import net.dankito.utils.multiplatform.extensions.getAllExceptionMessagesJoined
import net.dankito.utils.multiplatform.log.LoggerFactory import net.dankito.utils.multiplatform.log.LoggerFactory

View File

@ -6,7 +6,7 @@ import net.dankito.banking.fints.transactions.mt940.model.*
import net.dankito.utils.multiplatform.Date import net.dankito.utils.multiplatform.Date
import net.dankito.utils.multiplatform.DateFormatter import net.dankito.utils.multiplatform.DateFormatter
import net.dankito.utils.multiplatform.Month import net.dankito.utils.multiplatform.Month
import net.dankito.utils.multiplatform.isUpperCase import net.dankito.utils.multiplatform.extensions.isUpperCase
import net.dankito.utils.multiplatform.log.LoggerFactory import net.dankito.utils.multiplatform.log.LoggerFactory

View File

@ -1,6 +1,16 @@
package net.dankito.utils.multiplatform package net.dankito.utils.multiplatform
fun Date.isBefore(other: Date): Boolean {
return compareTo(other) < 0
}
fun Date.isBeforeOrEquals(other: Date): Boolean {
return compareTo(other) <= 0
}
fun Date.format(format: DateFormatter): String { fun Date.format(format: DateFormatter): String {
return format.format(this) return format.format(this)
} }

View File

@ -0,0 +1,13 @@
package net.dankito.utils.multiplatform.extensions
val Char.isLowerCase: Boolean
get() = lowercaseChar() == this
val Char.isUpperCase: Boolean
get() = isLowerCase == false
fun CharArray.asString(): String {
return this.joinToString("")
}

View File

@ -0,0 +1,8 @@
package net.dankito.utils.multiplatform.extensions
import net.dankito.utils.multiplatform.StringHelper
fun Int.format(format: String): String {
return StringHelper.format(format, this)
}

View File

@ -0,0 +1,8 @@
package net.dankito.utils.multiplatform.extensions
import net.dankito.utils.multiplatform.StringHelper
fun String.format(vararg args: Any?): String {
return StringHelper.format(this, args)
}

View File

@ -1,25 +1,4 @@
package net.dankito.utils.multiplatform package net.dankito.utils.multiplatform.extensions
val Char.isLowerCase: Boolean
get() = lowercaseChar() == this
val Char.isUpperCase: Boolean
get() = isLowerCase == false
fun CharArray.asString(): String {
return this.joinToString("")
}
fun Date.isBefore(other: Date): Boolean {
return compareTo(other) < 0
}
fun Date.isBeforeOrEquals(other: Date): Boolean {
return compareTo(other) <= 0
}
fun Throwable.getAllExceptionMessagesJoined(maxDepth: Int = 5): String { fun Throwable.getAllExceptionMessagesJoined(maxDepth: Int = 5): String {