Configurable is no longer MutableItemProvider. All functionality moved to Scheme
This commit is contained in:
parent
d68fbfd8a5
commit
1284aa9f2e
@ -38,15 +38,8 @@ public final class hep/dataforge/meta/ConfigKt {
|
|||||||
public static final fun get (Lhep/dataforge/meta/Config;Lhep/dataforge/names/NameToken;)Lhep/dataforge/meta/MetaItem;
|
public static final fun get (Lhep/dataforge/meta/Config;Lhep/dataforge/names/NameToken;)Lhep/dataforge/meta/MetaItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract interface class hep/dataforge/meta/Configurable : hep/dataforge/meta/MutableItemProvider {
|
public abstract interface class hep/dataforge/meta/Configurable {
|
||||||
public abstract fun getConfig ()Lhep/dataforge/meta/Config;
|
public abstract fun getConfig ()Lhep/dataforge/meta/Config;
|
||||||
public abstract fun getItem (Lhep/dataforge/names/Name;)Lhep/dataforge/meta/MetaItem;
|
|
||||||
public abstract fun setItem (Lhep/dataforge/names/Name;Lhep/dataforge/meta/MetaItem;)V
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class hep/dataforge/meta/Configurable$DefaultImpls {
|
|
||||||
public static fun getItem (Lhep/dataforge/meta/Configurable;Lhep/dataforge/names/Name;)Lhep/dataforge/meta/MetaItem;
|
|
||||||
public static fun setItem (Lhep/dataforge/meta/Configurable;Lhep/dataforge/names/Name;Lhep/dataforge/meta/MetaItem;)V
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class hep/dataforge/meta/ConfigurableKt {
|
public final class hep/dataforge/meta/ConfigurableKt {
|
||||||
@ -414,10 +407,8 @@ public final class hep/dataforge/meta/MutableItemDelegateKt {
|
|||||||
public static final fun stringList (Lhep/dataforge/meta/MutableItemProvider;[Ljava/lang/String;Lhep/dataforge/names/Name;)Lkotlin/properties/ReadWriteProperty;
|
public static final fun stringList (Lhep/dataforge/meta/MutableItemProvider;[Ljava/lang/String;Lhep/dataforge/names/Name;)Lkotlin/properties/ReadWriteProperty;
|
||||||
public static synthetic fun stringList$default (Lhep/dataforge/meta/MutableItemProvider;Lhep/dataforge/names/Name;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
|
public static synthetic fun stringList$default (Lhep/dataforge/meta/MutableItemProvider;Lhep/dataforge/names/Name;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
|
||||||
public static synthetic fun stringList$default (Lhep/dataforge/meta/MutableItemProvider;[Ljava/lang/String;Lhep/dataforge/names/Name;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
|
public static synthetic fun stringList$default (Lhep/dataforge/meta/MutableItemProvider;[Ljava/lang/String;Lhep/dataforge/names/Name;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
|
||||||
public static final fun value (Lhep/dataforge/meta/Configurable;Lhep/dataforge/names/Name;)Lkotlin/properties/ReadWriteProperty;
|
|
||||||
public static final fun value (Lhep/dataforge/meta/MutableItemProvider;Lhep/dataforge/names/Name;)Lkotlin/properties/ReadWriteProperty;
|
public static final fun value (Lhep/dataforge/meta/MutableItemProvider;Lhep/dataforge/names/Name;)Lkotlin/properties/ReadWriteProperty;
|
||||||
public static final fun value (Lhep/dataforge/meta/MutableItemProvider;Lhep/dataforge/names/Name;Lkotlin/jvm/functions/Function0;)Lkotlin/properties/ReadWriteProperty;
|
public static final fun value (Lhep/dataforge/meta/MutableItemProvider;Lhep/dataforge/names/Name;Lkotlin/jvm/functions/Function0;)Lkotlin/properties/ReadWriteProperty;
|
||||||
public static synthetic fun value$default (Lhep/dataforge/meta/Configurable;Lhep/dataforge/names/Name;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
|
|
||||||
public static synthetic fun value$default (Lhep/dataforge/meta/MutableItemProvider;Lhep/dataforge/names/Name;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
|
public static synthetic fun value$default (Lhep/dataforge/meta/MutableItemProvider;Lhep/dataforge/names/Name;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
|
||||||
public static synthetic fun value$default (Lhep/dataforge/meta/MutableItemProvider;Lhep/dataforge/names/Name;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
|
public static synthetic fun value$default (Lhep/dataforge/meta/MutableItemProvider;Lhep/dataforge/names/Name;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
|
||||||
}
|
}
|
||||||
@ -475,15 +466,15 @@ public final class hep/dataforge/meta/ObservableMeta$DefaultImpls {
|
|||||||
public static fun toMeta (Lhep/dataforge/meta/ObservableMeta;)Lhep/dataforge/meta/Meta;
|
public static fun toMeta (Lhep/dataforge/meta/ObservableMeta;)Lhep/dataforge/meta/Meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class hep/dataforge/meta/Scheme : hep/dataforge/meta/Configurable, hep/dataforge/meta/MetaRepr, hep/dataforge/meta/descriptors/Described {
|
public class hep/dataforge/meta/Scheme : hep/dataforge/meta/Configurable, hep/dataforge/meta/MetaRepr, hep/dataforge/meta/MutableItemProvider, hep/dataforge/meta/descriptors/Described {
|
||||||
public fun <init> ()V
|
public fun <init> ()V
|
||||||
public fun <init> (Lhep/dataforge/meta/Config;Lhep/dataforge/meta/ItemProvider;Lhep/dataforge/meta/descriptors/NodeDescriptor;)V
|
public fun <init> (Lhep/dataforge/meta/Config;Lhep/dataforge/meta/ItemProvider;Lhep/dataforge/meta/descriptors/NodeDescriptor;)V
|
||||||
public synthetic fun <init> (Lhep/dataforge/meta/Config;Lhep/dataforge/meta/ItemProvider;Lhep/dataforge/meta/descriptors/NodeDescriptor;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
public synthetic fun <init> (Lhep/dataforge/meta/Config;Lhep/dataforge/meta/ItemProvider;Lhep/dataforge/meta/descriptors/NodeDescriptor;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
public final fun getConfig ()Lhep/dataforge/meta/Config;
|
public fun getConfig ()Lhep/dataforge/meta/Config;
|
||||||
public final fun getDefaultItem (Lhep/dataforge/names/Name;)Lhep/dataforge/meta/MetaItem;
|
public final fun getDefaultItem (Lhep/dataforge/names/Name;)Lhep/dataforge/meta/MetaItem;
|
||||||
public fun getDefaultLayer ()Lhep/dataforge/meta/Meta;
|
public fun getDefaultLayer ()Lhep/dataforge/meta/Meta;
|
||||||
public synthetic fun getDescriptor ()Lhep/dataforge/meta/descriptors/ItemDescriptor;
|
public synthetic fun getDescriptor ()Lhep/dataforge/meta/descriptors/ItemDescriptor;
|
||||||
public final fun getDescriptor ()Lhep/dataforge/meta/descriptors/NodeDescriptor;
|
public fun getDescriptor ()Lhep/dataforge/meta/descriptors/NodeDescriptor;
|
||||||
public fun getItem (Lhep/dataforge/names/Name;)Lhep/dataforge/meta/MetaItem;
|
public fun getItem (Lhep/dataforge/names/Name;)Lhep/dataforge/meta/MetaItem;
|
||||||
public final fun isEmpty ()Z
|
public final fun isEmpty ()Z
|
||||||
public fun setItem (Lhep/dataforge/names/Name;Lhep/dataforge/meta/MetaItem;)V
|
public fun setItem (Lhep/dataforge/names/Name;Lhep/dataforge/meta/MetaItem;)V
|
||||||
@ -495,8 +486,8 @@ public class hep/dataforge/meta/Scheme : hep/dataforge/meta/Configurable, hep/da
|
|||||||
public final class hep/dataforge/meta/SchemeKt {
|
public final class hep/dataforge/meta/SchemeKt {
|
||||||
public static final fun asScheme (Lhep/dataforge/meta/Meta;)Lhep/dataforge/meta/Scheme;
|
public static final fun asScheme (Lhep/dataforge/meta/Meta;)Lhep/dataforge/meta/Scheme;
|
||||||
public static final fun invoke (Lhep/dataforge/meta/Scheme;Lkotlin/jvm/functions/Function1;)Lhep/dataforge/meta/Scheme;
|
public static final fun invoke (Lhep/dataforge/meta/Scheme;Lkotlin/jvm/functions/Function1;)Lhep/dataforge/meta/Scheme;
|
||||||
public static final fun toScheme (Lhep/dataforge/meta/Meta;Lhep/dataforge/meta/Specification;Lkotlin/jvm/functions/Function1;)Lhep/dataforge/meta/Configurable;
|
public static final fun toScheme (Lhep/dataforge/meta/Meta;Lhep/dataforge/meta/Specification;Lkotlin/jvm/functions/Function1;)Lhep/dataforge/meta/MutableItemProvider;
|
||||||
public static synthetic fun toScheme$default (Lhep/dataforge/meta/Meta;Lhep/dataforge/meta/Specification;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lhep/dataforge/meta/Configurable;
|
public static synthetic fun toScheme$default (Lhep/dataforge/meta/Meta;Lhep/dataforge/meta/Specification;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lhep/dataforge/meta/MutableItemProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class hep/dataforge/meta/SchemeSpec : hep/dataforge/meta/Specification, hep/dataforge/meta/descriptors/Described {
|
public class hep/dataforge/meta/SchemeSpec : hep/dataforge/meta/Specification, hep/dataforge/meta/descriptors/Described {
|
||||||
|
@ -6,23 +6,11 @@ import kotlin.properties.ReadWriteProperty
|
|||||||
/**
|
/**
|
||||||
* A container that holds a [Config].
|
* A container that holds a [Config].
|
||||||
*/
|
*/
|
||||||
public interface Configurable : MutableItemProvider {
|
public interface Configurable {
|
||||||
/**
|
/**
|
||||||
* Backing config
|
* Backing config
|
||||||
*/
|
*/
|
||||||
public val config: Config
|
public val config: Config
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a property with default
|
|
||||||
*/
|
|
||||||
override fun getItem(name: Name): MetaItem<*>? = config[name]
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a configurable property
|
|
||||||
*/
|
|
||||||
override fun setItem(name: Name, item: MetaItem<*>?) {
|
|
||||||
config.setItem(name, item)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,10 +118,6 @@ public inline fun <reified E : Enum<E>> MutableItemProvider.enum(
|
|||||||
public inline fun <reified M : MutableMeta<M>> M.node(key: Name? = null): ReadWriteProperty<Any?, M?> =
|
public inline fun <reified M : MutableMeta<M>> M.node(key: Name? = null): ReadWriteProperty<Any?, M?> =
|
||||||
item(key).convert(reader = { it?.let { it.node as M } }, writer = { it?.let { MetaItem.NodeItem(it) } })
|
item(key).convert(reader = { it?.let { it.node as M } }, writer = { it?.let { MetaItem.NodeItem(it) } })
|
||||||
|
|
||||||
|
|
||||||
public fun Configurable.value(key: Name? = null): ReadWriteProperty<Any?, Value?> =
|
|
||||||
item(key).convert(MetaConverter.value)
|
|
||||||
|
|
||||||
/* Number delegates */
|
/* Number delegates */
|
||||||
|
|
||||||
public fun MutableItemProvider.int(key: Name? = null): ReadWriteProperty<Any?, Int?> =
|
public fun MutableItemProvider.int(key: Name? = null): ReadWriteProperty<Any?, Int?> =
|
||||||
|
@ -13,7 +13,7 @@ public open class Scheme(
|
|||||||
config: Config = Config(),
|
config: Config = Config(),
|
||||||
internal var default: ItemProvider? = null,
|
internal var default: ItemProvider? = null,
|
||||||
descriptor: NodeDescriptor? = null,
|
descriptor: NodeDescriptor? = null,
|
||||||
) : Configurable, Described, MetaRepr {
|
) : Configurable, MutableItemProvider, Described, MetaRepr {
|
||||||
|
|
||||||
override var config: Config = config
|
override var config: Config = config
|
||||||
internal set
|
internal set
|
||||||
@ -44,7 +44,7 @@ public open class Scheme(
|
|||||||
*/
|
*/
|
||||||
override fun setItem(name: Name, item: MetaItem<*>?) {
|
override fun setItem(name: Name, item: MetaItem<*>?) {
|
||||||
if (validateItem(name, item)) {
|
if (validateItem(name, item)) {
|
||||||
super.setItem(name, item)
|
config.setItem(name, item)
|
||||||
} else {
|
} else {
|
||||||
error("Validation failed for property $name with value $item")
|
error("Validation failed for property $name with value $item")
|
||||||
}
|
}
|
||||||
@ -120,5 +120,5 @@ public open class SchemeSpec<T : Scheme>(
|
|||||||
|
|
||||||
public fun Meta.asScheme(): Scheme = Scheme(this.asConfig(), null, null)
|
public fun Meta.asScheme(): Scheme = Scheme(this.asConfig(), null, null)
|
||||||
|
|
||||||
public fun <T : Configurable> Meta.toScheme(spec: Specification<T>, block: T.() -> Unit = {}): T =
|
public fun <T : MutableItemProvider> Meta.toScheme(spec: Specification<T>, block: T.() -> Unit = {}): T =
|
||||||
spec.wrap(this).apply(block)
|
spec.wrap(this).apply(block)
|
||||||
|
Loading…
Reference in New Issue
Block a user