[kotlin][client] remove old Date usage (#11082)

* [kotlin][client] remove old Date usage

* [kotlin][client] remove old Date usage
This commit is contained in:
Bruno Coelho
2021-12-14 08:03:12 +00:00
committed by GitHub
parent 5416e92d19
commit eb224db540
515 changed files with 816 additions and 26447 deletions

View File

@@ -26,7 +26,6 @@ import java.time.LocalDateTime
import java.time.LocalTime
import java.time.OffsetDateTime
import java.time.OffsetTime
import java.util.Date
import java.util.Locale
import com.squareup.moshi.adapter
@@ -254,7 +253,7 @@ open class ApiClient(val baseUrl: String) {
null -> ""
is Array<*> -> toMultiValue(value, "csv").toString()
is Iterable<*> -> toMultiValue(value, "csv").toString()
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date ->
is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime ->
parseDateToQueryString(value)
else -> value.toString()
}

View File

@@ -1,29 +0,0 @@
package org.openapitools.client.infrastructure
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
object ApplicationDelegates {
/**
* Provides a property delegate, allowing the property to be set once and only once.
*
* If unset (no default value), a get on the property will throw [IllegalStateException].
*/
fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
private var isSet = false
private var value: T? = defaultValue
override fun getValue(thisRef: Any?, property: KProperty<*>): T {
return value ?: throw IllegalStateException("${property.name} not initialized")
}
override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
if (!isSet) {
this.value = value
isSet = true
}
}
}
}