Created
April 21, 2018 12:55
-
-
Save vibin/cd33670cf0eb27b007c2324c3e56a8ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.databinding.Observable | |
import android.databinding.ObservableField | |
class NonNullObservableField<T : Any>( | |
value: T, vararg dependencies: Observable | |
) : ObservableField<T>(*dependencies) { | |
init { | |
set(value) | |
} | |
override fun get(): T = super.get()!! | |
@Suppress("RedundantOverride") // Only allow non-null `value`. | |
override fun set(value: T) = super.set(value) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment