From eced45358e8c7145a26072d308be92766f6da26d Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Mon, 11 Oct 2021 10:01:16 +0200 Subject: [PATCH] chore (1) --- .../infrastructure/ApplicationDelegates.kt | 31 ------------------- .../engine/client/infrastructure/Element.kt | 3 -- 2 files changed, 34 deletions(-) delete mode 100644 engine-api/src/main/kotlin/de/gesellix/docker/engine/client/infrastructure/ApplicationDelegates.kt delete mode 100644 engine-api/src/main/kotlin/de/gesellix/docker/engine/client/infrastructure/Element.kt diff --git a/engine-api/src/main/kotlin/de/gesellix/docker/engine/client/infrastructure/ApplicationDelegates.kt b/engine-api/src/main/kotlin/de/gesellix/docker/engine/client/infrastructure/ApplicationDelegates.kt deleted file mode 100644 index 434e5b27..00000000 --- a/engine-api/src/main/kotlin/de/gesellix/docker/engine/client/infrastructure/ApplicationDelegates.kt +++ /dev/null @@ -1,31 +0,0 @@ -package de.gesellix.docker.engine.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 setOnce(defaultValue: T? = null): ReadWriteProperty = SetOnce(defaultValue) - - private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { - - 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 - } - } - } -} diff --git a/engine-api/src/main/kotlin/de/gesellix/docker/engine/client/infrastructure/Element.kt b/engine-api/src/main/kotlin/de/gesellix/docker/engine/client/infrastructure/Element.kt deleted file mode 100644 index 301f8785..00000000 --- a/engine-api/src/main/kotlin/de/gesellix/docker/engine/client/infrastructure/Element.kt +++ /dev/null @@ -1,3 +0,0 @@ -package de.gesellix.docker.engine.client.infrastructure - -data class Element(val type: ResponseType, val data: T? = null)