entry

@JvmName(name = "entry0")
inline fun <T : Any> Provider<Compound>.entry(key: String, noinline defaultValue: () -> T): MutableProvider<T>

Creates a MutableProvider of non-null type T that is linked to the value under key of this provider's Compound. If the compound does not have an entry under key, defaultValue is used to create it lazily. If there is already an entry provider for key that matches T, defaultValue will be ignored and the existing provider will be returned.

On resolving, the returned provider can throw IllegalArgumentException if there already is an entry provider for key, but for a different type.

See also


@JvmName(name = "entry1")
inline fun <T : Any> Provider<Compound?>.entry(key: String, noinline defaultValue: () -> T? = { null }): MutableProvider<T?>

Creates a MutableProvider of type T that is linked to the value under key of this provider's Compound. If the compound does not have an entry under key, defaultValue is used to create it lazily. If there is already an entry provider for key that matches T, defaultValue will be ignored and the existing provider will be returned.

On resolving, the returned provider can throw IllegalArgumentException if there already is an entry provider for key, but for a different type.

See also