Add more number delegates for read-only items.
This commit is contained in:
parent
fcba27cd72
commit
8529c725e7
@ -56,6 +56,7 @@ interface Configurable : Described, MutableItemProvider {
|
||||
/**
|
||||
* Reset the property to its default value
|
||||
*/
|
||||
@Deprecated("To be removed since unused", ReplaceWith("setItem(name, null)"))
|
||||
fun Configurable.resetProperty(name: Name) {
|
||||
setItem(name, null)
|
||||
}
|
||||
|
@ -41,6 +41,18 @@ fun ItemProvider.boolean(key: Name? = null): ReadOnlyProperty<Any?, Boolean?> =
|
||||
fun ItemProvider.number(key: Name? = null): ReadOnlyProperty<Any?, Number?> =
|
||||
item(key).convert(MetaConverter.number)
|
||||
|
||||
fun ItemProvider.double(key: Name? = null): ReadOnlyProperty<Any?, Double?> =
|
||||
item(key).convert(MetaConverter.double)
|
||||
|
||||
fun ItemProvider.float(key: Name? = null): ReadOnlyProperty<Any?, Float?> =
|
||||
item(key).convert(MetaConverter.float)
|
||||
|
||||
fun ItemProvider.int(key: Name? = null): ReadOnlyProperty<Any?, Int?> =
|
||||
item(key).convert(MetaConverter.int)
|
||||
|
||||
fun ItemProvider.long(key: Name? = null): ReadOnlyProperty<Any?, Long?> =
|
||||
item(key).convert(MetaConverter.long)
|
||||
|
||||
fun ItemProvider.node(key: Name? = null): ReadOnlyProperty<Any?, Meta?> =
|
||||
item(key).convert(MetaConverter.meta)
|
||||
|
||||
@ -53,6 +65,18 @@ fun ItemProvider.boolean(default: Boolean, key: Name? = null): ReadOnlyProperty<
|
||||
fun ItemProvider.number(default: Number, key: Name? = null): ReadOnlyProperty<Any?, Number> =
|
||||
item(key).convert(MetaConverter.number) { default }
|
||||
|
||||
fun ItemProvider.double(default: Double, key: Name? = null): ReadOnlyProperty<Any?, Double> =
|
||||
item(key).convert(MetaConverter.double) { default }
|
||||
|
||||
fun ItemProvider.float(default: Float, key: Name? = null): ReadOnlyProperty<Any?, Float> =
|
||||
item(key).convert(MetaConverter.float) { default }
|
||||
|
||||
fun ItemProvider.int(default: Int, key: Name? = null): ReadOnlyProperty<Any?, Int> =
|
||||
item(key).convert(MetaConverter.int) { default }
|
||||
|
||||
fun ItemProvider.long(default: Long, key: Name? = null): ReadOnlyProperty<Any?, Long> =
|
||||
item(key).convert(MetaConverter.long) { default }
|
||||
|
||||
inline fun <reified E : Enum<E>> ItemProvider.enum(default: E, key: Name? = null): ReadOnlyProperty<Any?, E> =
|
||||
item(key).convert(MetaConverter.enum()) { default }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user