Coverage Summary for Class: SingleInitDelegate (cloud.mindbox.mobile_sdk.utils)

Class Class, % Method, % Branch, % Line, % Instruction, %
SingleInitDelegate 100% (1/1) 100% (3/3) 75% (3/4) 100% (5/5) 100% (19/19)


 package cloud.mindbox.mobile_sdk.utils
 
 import kotlin.properties.ReadWriteProperty
 import kotlin.reflect.KProperty
 
 internal class SingleInitDelegate<T> : ReadWriteProperty<Any?, List<T>> {
 
     private var value: List<T> = emptyList()
 
     override fun getValue(thisRef: Any?, property: KProperty<*>): List<T> {
         return value
     }
 
     override fun setValue(thisRef: Any?, property: KProperty<*>, value: List<T>) {
         if (this.value.isEmpty() && value.isNotEmpty()) {
             this.value = value
         }
     }
 }