Closed dlurton closed 4 years ago
Problems with IonType:
IonType
DATAGRAM
IonElement
IonType.isText(type)
It might be better to have ElementType, something like:
ElementType
enum class ElementType( val isText: Boolean, val isSequence: Boolean, val isBinary: Boolean ) { NULL(false false false), BOOL(false, false false), INT(false, false false) FLOAT(false, false false) DECIMAL(false, false false) TIMESTAMP(false, false false) SYMBOL(true false false) STRING(true, false false), CLOB(false, false, true), BLOB(false, false, true), LIST(false, true, false, SEXP(false, true, false), STRUCT(false, true, false); /** Converts this [ElementType] to [IonType]. */ fun toIonType(type: IonType) = when(this) { ... } } /** Converts this [IonType] to [ElementType]. */ fun IonType.toElementType() = when(this) { ... }
Then instead of:
if(IonType.isText(element.type)) { ... }
We can:
if(element.type.isText) { ... }
Problems with
IonType
:DATAGRAM
whichIonElement
does not supportIonType.isText(type)
which is jarring and awkward to use from Kotlin.It might be better to have
ElementType
, something like:Then instead of:
We can: