Update descriptor cache

This commit is contained in:
Alexander Nozik 2021-05-09 22:27:52 +03:00
parent 3888b2d9e7
commit a6f1e54255
3 changed files with 10 additions and 4 deletions

View File

@ -548,8 +548,8 @@ public final class space/kscience/dataforge/meta/descriptors/ItemDescriptorKt {
public abstract interface class space/kscience/dataforge/meta/descriptors/NodeDescriptor : space/kscience/dataforge/meta/descriptors/ItemDescriptor {
public static final field Companion Lspace/kscience/dataforge/meta/descriptors/NodeDescriptor$Companion;
public fun defaultMeta ()Lspace/kscience/dataforge/meta/Laminate;
public abstract fun getDefault ()Lspace/kscience/dataforge/meta/Config;
public abstract fun getDefaultMeta ()Lspace/kscience/dataforge/meta/Laminate;
public abstract fun getItems ()Ljava/util/Map;
public abstract fun getNodes ()Ljava/util/Map;
public abstract fun getRequired ()Z
@ -567,6 +567,7 @@ public final class space/kscience/dataforge/meta/descriptors/NodeDescriptorBuild
public synthetic fun build ()Lspace/kscience/dataforge/meta/descriptors/ItemDescriptor;
public fun build ()Lspace/kscience/dataforge/meta/descriptors/NodeDescriptor;
public fun getDefault ()Lspace/kscience/dataforge/meta/Config;
public fun getDefaultMeta ()Lspace/kscience/dataforge/meta/Laminate;
public fun getDefaultValue ()Lspace/kscience/dataforge/meta/TypedMetaItem;
public fun getItems ()Ljava/util/Map;
public fun getNodes ()Ljava/util/Map;

View File

@ -61,7 +61,7 @@ public sealed interface NodeDescriptor : ItemDescriptor {
/**
* Generate a laminate representing default item set generated by this descriptor
*/
public fun defaultMeta(): Laminate = Laminate(default, DescriptorMeta(this))
public val defaultMeta: Laminate
public companion object {
@ -187,10 +187,15 @@ public class NodeDescriptorBuilder(config: Config = Config()) : ItemDescriptorBu
value(name.toName(), block)
}
/**
* Generate a laminate representing default item set generated by this descriptor
*/
override val defaultMeta: Laminate by lazy { Laminate(default, DescriptorMeta(this)) }
/**
* Build a default [MetaItemNode] from this node descriptor
*/
override val defaultValue: MetaItem by lazy { MetaItemNode(defaultMeta()) }
override val defaultValue: MetaItem get() = MetaItemNode(defaultMeta)
override fun build(): NodeDescriptor = NodeDescriptorBuilder(config.copy())

View File

@ -36,7 +36,7 @@ class DescriptorTest {
@Test
fun testDefaultMetaNode(){
val meta = descriptor.defaultMeta()
val meta = descriptor.defaultMeta
assertEquals(false, meta["aNode.otherNode.otherValue"].boolean)
}
}