Fragment

open class Fragment(source)

Fragment provides readonly access to data value. Fragment also provides subscript access by either key or index to the nested values which are wrapped by Fragment objects.

Inheritors

Properties

Link copied to clipboard
open val array: Array?

Get the value as an Array, a mapping object of an array value. Returns null if the value is null, or the value is not an array.

Link copied to clipboard
open val blob: Blob?

Get the value as a Blob. Returns null if the value is null, or the value is not a Blob.

Link copied to clipboard
open val boolean: Boolean

Gets the value as a boolean. Returns true if the value is not null, and is either true or a nonzero number.

Link copied to clipboard
open val date: Instant?

Gets the value as a date. JSON does not directly support dates, so the actual property value must be a string, which is then parsed according to the ISO-8601 date format (the default used in JSON.) Returns null if the value is null, is not a string, or is not parseable as a date. NOTE: This is not a generic date parser! It only recognizes the ISO-8601 format, with or without milliseconds.

Link copied to clipboard

Get a property’s value as a Dictionary, a mapping object of a dictionary value. Returns null if the value is null, or the value is not a dictionary.

Link copied to clipboard
open val double: Double

Gets the value as a double. Integers will be converted to double. The value true is returned as 1.0, false as 0.0. Returns 0.0 if the value is null or is not a numeric value.

Link copied to clipboard

Checks whether the value held by the fragment object exists or is null value or not.

Link copied to clipboard
open val float: Float

Gets the value as a float. Integers will be converted to float. The value true is returned as 1.0, false as 0.0. Returns 0.0 if the value is null or is not a numeric value.

Link copied to clipboard
open val int: Int

Gets the value as an int. Floating point values will be rounded. The value true is returned as 1, false as 0. Returns 0 if the value is null or is not a numeric value.

Link copied to clipboard
open val long: Long

Gets the value as a long. Floating point values will be rounded. The value true is returned as 1, false as 0. Returns 0 if the value is null or is not a numeric value.

Link copied to clipboard
open val number: Number?

Gets the value as a Number. Returns null if the value doesn't exist, or its value is not a Number.

Link copied to clipboard
open val string: String?

Gets the value as a string. Returns null if the value is null, or the value is not a string.

Link copied to clipboard
open val value: Any?

Gets the fragment value. The value types are Blob, Array, Dictionary, Number, or String based on the underlying data type; or null if the value is null.

Functions

Link copied to clipboard
open operator fun get(index: Int): Fragment

Subscript access to a Fragment object by index.

open operator fun get(key: String): Fragment

Subscript access to a Fragment object by key.