Builder

class Builder @JvmOverloads constructor(copy: DataList = EMPTY_LIST)

Constructors

Link copied to clipboard
constructor(copy: DataList = EMPTY_LIST)

Functions

Link copied to clipboard
fun add(value: DataItem, index: Int = DEFAULT_INDEX): DataList.Builder

Adds a DataItem to the List.

fun add(value: DataItemConvertible, index: Int = DEFAULT_INDEX): DataList.Builder

Adds a DataItemConvertible to the list. The value is first converted into a DataItem using its implementation of asDataItem.

fun add(value: Boolean, index: Int = DEFAULT_INDEX): DataList.Builder

Adds a Boolean to the List.

fun add(value: Double, index: Int = DEFAULT_INDEX): DataList.Builder

Adds a Double to the List.

fun add(value: Int, index: Int = DEFAULT_INDEX): DataList.Builder

Adds an Int to the List.

fun add(value: Long, index: Int = DEFAULT_INDEX): DataList.Builder

Adds a Long to the List.

fun add(value: String, index: Int = DEFAULT_INDEX): DataList.Builder

Adds a String to the List.

Link copied to clipboard
fun addAll(list: DataList, index: Int = DEFAULT_INDEX): DataList.Builder

Adds all entries from the given list to this builder. If an index is provided then the entries are inserted starting at that index.

Link copied to clipboard
fun addAny(any: Any?, index: Int = DEFAULT_INDEX): DataList.Builder

Unsafe shortcut to put any object into the DataList.Builder. The any will attempt to be converted to a supported type. If an unsupported type is found, then this method with throw.

Link copied to clipboard
fun addAnyOrNull(any: Any?, index: Int = DEFAULT_INDEX): DataList.Builder

Unsafe shortcut to put any object into the DataObject. The any will attempt to be converted to a supported type. If no supported type is available, then DataItem.NULL will be returned.

Link copied to clipboard
fun addNull(index: Int = DEFAULT_INDEX): DataList.Builder

Adds a DataItem.NULL to the list.

Link copied to clipboard

Creates the new DataList based on the entries provided to this Builder

Link copied to clipboard

Takes a copy of this DataList and builds the necessary path according to the given path in order to store the given item.

Link copied to clipboard

Removes all entries from the current Builder

Link copied to clipboard
operator fun get(index: Int): DataItem?

Gets the DataItem at the given index, if there is one.

Link copied to clipboard

Removes the item at the give index.

Link copied to clipboard
fun size(): Int

Returns the number of entries currently in this DataList.Builder.