Forgot to commit ObjectReference which is already used for some time

This commit is contained in:
dankito 2020-12-22 14:16:43 +01:00
parent 4ddb55e612
commit bc6e8aed51
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
package net.dankito.utils.multiplatform
open class ObjectReference<T>(
value: T?,
open val valueChangedListener: ((T?) -> Unit)? = null
) {
open var value: T? = value
set(value) {
field = value
valueChangedListener?.invoke(value)
}
override fun toString(): String {
return "$value"
}
}