NameSpacedData

Key/value pairs, organized by name space.

This class implements a data model which consists of a series of name spaces (identified by a string such as org.iso.18013.5.1) where each name space contains a number of key/value pairs where keys are strings and values are CBOR values.

While this happens to be similar to the mDL/MDOC data model used in ISO/IEC 18013-5:2021, it's flexible enough to be used to store document data for any kind of document.

This type is immutable.

Types

Link copied to clipboard
class Builder(nameSpacedDataToCopyFrom: NameSpacedData? = null)

A builder for NameSpacedData.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Names of all the namespaces.

Functions

Link copied to clipboard

Encodes the given NameSpacedData as CBOR.

Link copied to clipboard
fun getDataElement(nameSpaceName: String, dataElementName: String): ByteArray

Gets the raw CBOR for a data element.

Link copied to clipboard
fun getDataElementBoolean(nameSpaceName: String, dataElementName: String): Boolean

Like .getDataElement but decodes the CBOR as a boolean.

Link copied to clipboard
fun getDataElementByteString(nameSpaceName: String, dataElementName: String): ByteArray

Like .getDataElement but decodes the CBOR as a byte string.

Link copied to clipboard
fun getDataElementNames(nameSpaceName: String): List<String>

Gets all data elements in a given namespace.

Link copied to clipboard
fun getDataElementNumber(nameSpaceName: String, dataElementName: String): Long

Like .getDataElement but decodes the CBOR as a number.

Link copied to clipboard
fun getDataElementString(nameSpaceName: String, dataElementName: String): String

Like .getDataElement but decodes the CBOR as a string.

Link copied to clipboard
fun hasDataElement(nameSpaceName: String, dataElementName: String): Boolean

Checks if there's a value for a given data element.

Link copied to clipboard