amazon-ion / ion-element-kotlin

IonElement is an immutable in-memory representation of the Ion data format. IonElement's API is idiomatic to Kotlin.
Apache License 2.0
8 stars 7 forks source link

Allow persisting of metas #20

Open dlurton opened 4 years ago

dlurton commented 4 years ago

Currently we do not persist metas in any form. However, it might be useful to allow metas to be persisted in Ion to

/* or Element, depending on the interface which defines metas at the time of implementation */
interface IonElement { 
    // Change metas to:
    val metas: Map<String, IonElementConvertible>
}

interface IonElementConvertible {
   fun toIonElement(): IonElement
}

This also implies the need for some method of reading metas. For that:

interface IonElementTransformer<T> {
    fun transform(element: IonElement): T
}

interface IonElementLoaderOptions {
    val metaLoaderRegistry: Map<String, IonElementTransformer<IonElementConvertible>>
}

IonElementLoaderOptions is also described in #19