Package space.kscience.dataforge.meta

Types

Configurable
Link copied to clipboard
common
interface Configurable

A container that holds a ObservableMeta.

DynamicMeta
Link copied to clipboard
js
class DynamicMeta(obj: dynamic) : TypedMeta<DynamicMeta>
Laminate
Link copied to clipboard
common
class Laminate : TypedMeta<Laminate>

A meta laminate consisting of multiple immutable meta layers. For mutable front layer, use Scheme. If layers list contains a Laminate it is flat-mapped.

Meta
Link copied to clipboard
common
@Type(id = "meta")
interface Meta : MetaRepr, MetaProvider

A meta node TODO add documentation Same name siblings are supported via elements with the same Name but different indices.

MetaBuilder
Link copied to clipboard
common
annotation class MetaBuilder

Mark a meta builder

MetaProvider
Link copied to clipboard
common
fun interface MetaProvider : ValueProvider

A container for meta nodes

MetaRepr
Link copied to clipboard
common
interface MetaRepr

The object that could be represented as Meta. Meta provided by toMeta method should fully represent object state. Meaning that two states with the same meta are equal.

MetaSerializer
Link copied to clipboard
common
object MetaSerializer : KSerializer<Meta>

Serialized for Meta

MutableMeta
Link copied to clipboard
common
interface MutableMeta : Meta, MutableMetaProvider

Mutable variant of Meta TODO documentation

MutableMetaProvider
Link copied to clipboard
common
interface MutableMetaProvider : MetaProvider, MutableValueProvider

A generic interface that gives access to getting and setting meta notes and values

MutableMetaSerializer
Link copied to clipboard
common
object MutableMetaSerializer : KSerializer<MutableMeta>

A serializer for MutableMeta

MutableTypedMeta
Link copied to clipboard
common
interface MutableTypedMeta<M : MutableTypedMeta<M>> : TypedMeta<M> , MutableMeta
ObservableMeta
Link copied to clipboard
common
interface ObservableMeta : Meta

An item provider that could be observed and mutated

ObservableMutableMeta
Link copied to clipboard
common

A Meta which is both observable and mutable

ReadOnlySpecification
Link copied to clipboard
common
interface ReadOnlySpecification<out T : Any>
Scheme
Link copied to clipboard
common
open class Scheme : Described, MetaRepr, MutableMetaProvider, Configurable

A base for delegate-based or descriptor-based scheme. Scheme has an empty constructor to simplify usage from Specification. Default item provider and MetaDescriptor are optional

SchemeSpec
Link copied to clipboard
common
open class SchemeSpec<out T : Scheme>(builder: () -> T) : Specification<T> , Described

A specification for simplified generation of wrappers

SealedMeta
Link copied to clipboard
common
class SealedMeta : TypedMeta<SealedMeta>

The meta implementation which is guaranteed to be immutable.

Specification
Link copied to clipboard
common
interface Specification<out T : Any> : ReadOnlySpecification<T>

Allows to apply custom configuration in a type safe way to simple untyped configuration. By convention Scheme companion should inherit this class

TypedMeta
Link copied to clipboard
common
interface TypedMeta<out M : TypedMeta<M>> : Meta

A meta node that ensures that all of its descendants has at least the same type.

Functions

append
Link copied to clipboard
common
fun MutableMeta.append(key: String, meta: Meta)
fun MutableMeta.append(key: String, value: Value)
fun MutableMeta.append(name: Name, value: Value)
fun MutableMeta.append(name: Name, meta: Meta)

Append the node with a same-name-sibling, automatically generating numerical index

asMutableMeta
Link copied to clipboard
common
fun Meta.asMutableMeta(): MutableMeta
asObservable
Link copied to clipboard
common
fun MutableMeta.asObservable(): ObservableMutableMeta

Cast this MutableMeta to ObservableMutableMeta or create an observable wrapper. Only changes made to the result are guaranteed to be observed.

boolean
Link copied to clipboard
common
fun MetaProvider.boolean(key: Name? = null): ReadOnlyProperty<Any?, Boolean?>
fun MutableMetaProvider.boolean(key: Name? = null): ReadWriteProperty<Any?, Boolean?>
fun MetaProvider.boolean(default: Boolean, key: Name? = null): ReadOnlyProperty<Any?, Boolean>
fun MetaProvider.boolean(key: Name? = null, default: () -> Boolean): ReadOnlyProperty<Any?, Boolean>
fun MutableMetaProvider.boolean(default: Boolean, key: Name? = null): ReadWriteProperty<Any?, Boolean>
fun MutableMetaProvider.boolean(key: Name? = null, default: () -> Boolean): ReadWriteProperty<Any?, Boolean>
configure
Link copied to clipboard
common
inline fun <T : Configurable> T.configure(action: MutableMeta.() -> Unit): T
fun <T : Configurable> T.configure(meta: Meta): T
copy
Link copied to clipboard
common
inline fun Meta.copy(block: MutableMeta.() -> Unit = {}): Meta

Create a copy of this Meta, optionally applying the given block. The listeners of the original Config are not retained.

inline fun <T : Scheme> T.copy(spec: SchemeSpec<T>, block: T.() -> Unit = {}): T

Create a copy of given Scheme

double
Link copied to clipboard
common
fun MetaProvider.double(key: Name? = null): ReadOnlyProperty<Any?, Double?>
fun MutableMetaProvider.double(key: Name? = null): ReadWriteProperty<Any?, Double?>
fun MetaProvider.double(default: Double, key: Name? = null): ReadOnlyProperty<Any?, Double>
fun MutableMetaProvider.double(default: Double, key: Name? = null): ReadWriteProperty<Any?, Double>
doubleArray
Link copied to clipboard
common
fun MutableMetaProvider.doubleArray(vararg default: Double, key: Name? = null): ReadWriteProperty<Any?, DoubleArray>
edit
Link copied to clipboard
common
fun <M : MutableTypedMeta<M>> MutableTypedMeta<M>.edit(name: Name, builder: M.() -> Unit): M

Edit node at name

enum
Link copied to clipboard
common
inline fun <E : Enum<E>> Meta?.enum(): E?
inline fun <E : Enum<E>> MetaProvider.enum(default: E, key: Name? = null): ReadOnlyProperty<Any?, E>
inline fun <E : Enum<E>> MutableMetaProvider.enum(default: E, key: Name? = null): ReadWriteProperty<Any?, E>
float
Link copied to clipboard
common
fun MetaProvider.float(key: Name? = null): ReadOnlyProperty<Any?, Float?>
fun MutableMetaProvider.float(key: Name? = null): ReadWriteProperty<Any?, Float?>
fun MetaProvider.float(default: Float, key: Name? = null): ReadOnlyProperty<Any?, Float>
fun MutableMetaProvider.float(default: Float, key: Name? = null): ReadWriteProperty<Any?, Float>
get
Link copied to clipboard
common
operator fun Meta.get(key: String): Meta?

Parse Name from key using full name notation and pass it to Meta.get

operator fun Meta.get(name: Name): Meta?

Perform recursive item search using given name. Each NameToken is treated as a name in Meta.items of a parent node.

operator fun Meta.get(token: NameToken): Meta?
operator fun <M : TypedMeta<M>> TypedMeta<M>.get(token: NameToken): M?
operator fun <M : TypedMeta<M>> TypedMeta<M>.get(key: String): M?

Parse Name from key using full name notation and pass it to TypedMeta.get

operator tailrec fun <M : TypedMeta<M>> TypedMeta<M>.get(name: Name): M?

Perform recursive item search using given name. Each NameToken is treated as a name in TypedMeta.items of a parent node.

getFirst
Link copied to clipboard
common
fun Laminate.getFirst(name: Name): Meta?

Performance optimized version of get method

getIndexed
Link copied to clipboard
common
fun Meta.getIndexed(name: Name): Map<String?, Meta>
fun <M : TypedMeta<M>> TypedMeta<M>.getIndexed(name: Name): Map<String?, M>

Get all items matching given name. The index of the last element, if present is used as a Regex, against which indexes of elements are matched.

fun <M : TypedMeta<M>> TypedMeta<M>.getIndexed(name: String): Map<String?, Meta>
getOrCreate
Link copied to clipboard
common
fun <M : MutableTypedMeta<M>> M.getOrCreate(key: String): M
fun MutableMeta.getOrCreate(key: String): MutableMeta
int
Link copied to clipboard
common
fun MetaProvider.int(key: Name? = null): ReadOnlyProperty<Any?, Int?>
fun MutableMetaProvider.int(key: Name? = null): ReadWriteProperty<Any?, Int?>
fun MetaProvider.int(default: Int, key: Name? = null): ReadOnlyProperty<Any?, Int>
fun MutableMetaProvider.int(default: Int, key: Name? = null): ReadWriteProperty<Any?, Int>
invoke
Link copied to clipboard
common
inline operator fun <T : Scheme> T.invoke(block: T.() -> Unit): T

A shortcut to edit a Scheme object in-place

isEmpty
Link copied to clipboard
common
fun Meta.isEmpty(): Boolean
iterator
Link copied to clipboard
common
operator fun Meta.iterator(): Iterator<Pair<Name, Meta>>
Laminate
Link copied to clipboard
common
fun Laminate(vararg layers: Meta?): Laminate
fun Laminate(layers: Collection<Meta?>): Laminate
listOfSpec
Link copied to clipboard
common
fun <T : Scheme> MutableMeta.listOfSpec(spec: Specification<T>, key: Name? = null): ReadWriteProperty<Any?, List<T>>

A delegate that uses a Specification to wrap a list of child providers. If children are mutable, the changes in list elements are reflected on them. The list is a snapshot of children state, so change in structure is not reflected on its composition.

listValue
Link copied to clipboard
common
fun <T> MutableMetaProvider.listValue(key: Name? = null, writer: (T) -> Value = { Value.of(it) }, reader: (Value) -> T): ReadWriteProperty<Any?, List<T>?>
long
Link copied to clipboard
common
fun MetaProvider.long(key: Name? = null): ReadOnlyProperty<Any?, Long?>
fun MutableMetaProvider.long(key: Name? = null): ReadWriteProperty<Any?, Long?>
fun MetaProvider.long(default: Long, key: Name? = null): ReadOnlyProperty<Any?, Long>
fun MutableMetaProvider.long(default: Long, key: Name? = null): ReadWriteProperty<Any?, Long>
Meta
Link copied to clipboard
common
fun Meta(value: Boolean): SealedMeta
inline fun Meta(builder: MutableMeta.() -> Unit): SealedMeta
fun Meta(value: Number): SealedMeta
fun Meta(value: String): SealedMeta
fun Meta(value: Value): SealedMeta
MutableMeta
Link copied to clipboard
common
fun MutableMeta(): ObservableMutableMeta
inline fun MutableMeta(builder: MutableMeta.() -> Unit = {}): ObservableMutableMeta

Build a MutableMeta using given transformation

node
Link copied to clipboard
common
fun MetaProvider.node(key: Name? = null): ReadOnlyProperty<Any?, Meta?>
fun MutableMetaProvider.node(key: Name? = null): ReadWriteProperty<Any?, Meta?>
fun <T> MetaProvider.node(key: Name? = null, converter: MetaConverter<T>): ReadOnlyProperty<Any?, T?>
fun <T> MutableMetaProvider.node(key: Name? = null, converter: MetaConverter<T>): ReadWriteProperty<Any?, T?>
nodeSequence
Link copied to clipboard
common
fun Meta.nodeSequence(): Sequence<Pair<Name, Meta>>

Get a sequence of all Name-TypedMeta pairs in a top-down traversal

number
Link copied to clipboard
common
fun MetaProvider.number(key: Name? = null): ReadOnlyProperty<Any?, Number?>
fun MutableMetaProvider.number(key: Name? = null): ReadWriteProperty<Any?, Number?>
fun MetaProvider.number(default: Number, key: Name? = null): ReadOnlyProperty<Any?, Number>
fun MetaProvider.number(key: Name? = null, default: () -> Number): ReadOnlyProperty<Any?, Number>
fun MutableMetaProvider.number(default: Number, key: Name? = null): ReadWriteProperty<Any?, Number>
fun MutableMetaProvider.number(key: Name? = null, default: () -> Number): ReadWriteProperty<Any?, Number>
numberList
Link copied to clipboard
common
fun MutableMetaProvider.numberList(vararg default: Number, key: Name? = null): ReadWriteProperty<Any?, List<Number>>
remove
Link copied to clipboard
common
fun MutableMetaProvider.remove(key: String)
fun MutableMetaProvider.remove(name: Name)
retarget
Link copied to clipboard
common
fun <T : Scheme> T.retarget(provider: MutableMeta): T

Relocate scheme target onto given MutableMeta. Old provider does not get updates anymore. Current state of the scheme used as a default.

seal
Link copied to clipboard
common
fun Meta.seal(): SealedMeta

Generate sealed node from this. If it is already sealed return it as is.

set
Link copied to clipboard
common
operator fun MutableMeta.set(key: String, value: Boolean)
operator fun MutableMeta.set(key: String, value: Number)
operator fun MutableMeta.set(key: String, value: String)
operator fun MutableMeta.set(key: String, metas: Iterable<Meta>)
operator fun MutableMeta.set(key: String, value: List<Value>)
operator fun MutableMeta.set(key: String, value: Value?)
operator fun MutableMeta.set(name: Name, value: Boolean)
operator fun MutableMeta.set(name: Name, value: Number)
operator fun MutableMeta.set(name: Name, value: String)
operator fun MutableMeta.set(name: Name, metas: Iterable<Meta>)
operator fun MutableMeta.set(name: Name, value: List<Value>)
operator fun MutableMeta.set(name: NameToken, value: Boolean)
operator fun MutableMeta.set(name: NameToken, value: Number)
operator fun MutableMeta.set(name: NameToken, value: String)
operator fun MutableMeta.set(name: NameToken, value: List<Value>)
operator fun MutableMeta.set(name: NameToken, value: Value?)
operator fun MutableMetaProvider.set(key: String, value: Meta)
operator fun MutableMetaProvider.set(Key: NameToken, value: Meta)
operator fun MutableMeta.set(name: Name, meta: Meta)

Set or replace node at given name

operator fun MutableMeta.set(name: Name, value: Value?)

Set or replace value at given name

operator fun <M : MutableTypedMeta<M>> MutableTypedMeta<M>.set(name: Name, value: Value?)

Set a value at a given name. If node does not exist, create it.

setIndexed
Link copied to clipboard
common
fun MutableMeta.setIndexed(name: Name, metas: Iterable<Meta>, indexFactory: (Meta, index: Int) -> String = { _, index -> index.toString() })
spec
Link copied to clipboard
common
fun <T : Scheme> MutableMeta.spec(spec: Specification<T>, key: Name? = null): ReadWriteProperty<Any?, T>

A delegate that uses a Specification to wrap a child of this provider

fun <T : Scheme> Scheme.spec(spec: Specification<T>, key: Name? = null): ReadWriteProperty<Any?, T>
string
Link copied to clipboard
common
fun MetaProvider.string(key: Name? = null): ReadOnlyProperty<Any?, String?>
fun MutableMetaProvider.string(key: Name? = null): ReadWriteProperty<Any?, String?>
fun MetaProvider.string(default: String, key: Name? = null): ReadOnlyProperty<Any?, String>
fun MetaProvider.string(key: Name? = null, default: () -> String): ReadOnlyProperty<Any?, String>
fun MutableMetaProvider.string(default: String, key: Name? = null): ReadWriteProperty<Any?, String>
fun MutableMetaProvider.string(key: Name? = null, default: () -> String): ReadWriteProperty<Any?, String>
stringList
Link copied to clipboard
common
fun MutableMetaProvider.stringList(key: Name? = null): ReadWriteProperty<Any?, List<String>?>
fun MutableMetaProvider.stringList(vararg default: String, key: Name? = null): ReadWriteProperty<Any?, List<String>>
toDynamic
Link copied to clipboard
js
fun Meta.toDynamic(): dynamic

Represent or copy this Meta to dynamic object to be passed to JS libraries

fun Value.toDynamic(): dynamic
toJson
Link copied to clipboard
common
fun Meta.toJson(descriptor: MetaDescriptor? = null): JsonObject
fun Value.toJson(descriptor: MetaDescriptor? = null): JsonElement
toMap
Link copied to clipboard
common
fun Meta.toMap(descriptor: MetaDescriptor? = null): Map<String, Any?>

Convert meta to map of maps

toMeta
Link copied to clipboard
common
fun Map<String, Any?>.toMeta(descriptor: MetaDescriptor? = null): Meta

Convert map of maps to meta. This method will recognize Meta, Map and List of all mentioned above as value. All other values will be converted to Value.

fun JsonElement.toMeta(descriptor: MetaDescriptor? = null): SealedMeta
fun JsonObject.toMeta(descriptor: MetaDescriptor? = null): SealedMeta
toMutableMeta
Link copied to clipboard
common
fun Meta.toMutableMeta(): ObservableMutableMeta

Create a mutable copy of this meta. The copy is created even if the Meta is already mutable

toValue
Link copied to clipboard
common
fun JsonPrimitive.toValue(descriptor: MetaDescriptor?): Value

Convert a Json primitive to a Value

update
Link copied to clipboard
common
fun MutableMeta.update(meta: Meta)

Update existing mutable node with another node. The rules are following:

updateWith
Link copied to clipboard
common
fun <T : Any> Configurable.updateWith(spec: Specification<T>, action: T.() -> Unit): T

Update configuration using given specification

fun <T : Any> MutableMeta.updateWith(spec: Specification<T>, action: T.() -> Unit): T

Update a MutableMeta using given specification

useProperty
Link copied to clipboard
common
fun <S : Scheme, T> S.useProperty(property: KProperty1<S, T>, owner: Any? = null, callBack: S.(T) -> Unit)

Use the value of the property in a callBack. The callback is called once immediately after subscription to pass the initial value.

value
Link copied to clipboard
common
fun MetaProvider.value(key: Name? = null): ReadOnlyProperty<Any?, Value?>

A property delegate that uses custom key

fun MutableMetaProvider.value(key: Name? = null): ReadWriteProperty<Any?, Value?>
fun <R> MetaProvider.value(key: Name? = null, reader: (Value?) -> R): ReadOnlyProperty<Any?, R>
fun <T> MutableMetaProvider.value(key: Name? = null, writer: (T) -> Value? = { Value.of(it) }, reader: (Value?) -> T): ReadWriteProperty<Any?, T>
valueSequence
Link copied to clipboard
common
fun Meta.valueSequence(): Sequence<Pair<Name, Value>>

Get a sequence of Name-Value pairs using top-down traversal of the tree

withBottom
Link copied to clipboard
common
fun Laminate.withBottom(meta: Meta): Laminate

Create a new Laminate adding given layer to the bottom

withDefault
Link copied to clipboard
common
fun Meta.withDefault(default: Meta?): Meta

Create a provider that uses given provider for default values if those are not found in this provider

fun MutableMeta.withDefault(default: Meta?): MutableMeta

Create a mutable item provider that uses given provider for default values if those are not found in this provider. Changes are propagated only to this provider.

withTop
Link copied to clipboard
common
fun Laminate.withTop(meta: Meta): Laminate

Create a new Laminate adding given layer to the top

Properties

boolean
Link copied to clipboard
common
val Meta?.boolean: Boolean?
double
Link copied to clipboard
common
val Meta?.double: Double?
float
Link copied to clipboard
common
val Meta?.float: Float?
int
Link copied to clipboard
common
val Meta?.int: Int?
isLeaf
Link copied to clipboard
common
val Meta.isLeaf: Boolean

True if this Meta does not have children

JSON_ARRAY_KEY
Link copied to clipboard
common
val Meta.Companion.JSON_ARRAY_KEY: String
long
Link copied to clipboard
common
val Meta?.long: Long?
number
Link copied to clipboard
common
val Meta?.number: Number?
self
Link copied to clipboard
common
val <M : TypedMeta<M>> TypedMeta<M>.self: M

Access self as a recursive type instance

short
Link copied to clipboard
common
val Meta?.short: Short?
string
Link copied to clipboard
common
val Meta?.string: String?
stringList
Link copied to clipboard
common
val Meta.stringList: List<String>?