Participe do evento ⁠#Android11: apresentação de lançamento da versão Beta no dia 3 de junho.

Builder

class Builder
kotlin.Any
   ↳ androidx.work.Data.Builder

A builder for Data objects.

Summary

Public constructors

A builder for Data objects.

Public methods

Data

Builds a Data object.

Data.Builder
putAll(@NonNull data: Data)

Puts all input key-value pairs from a Data into the Builder.

Data.Builder
putAll(@NonNull values: MutableMap<String!, Any!>)

Puts all input key-value pairs from a Map into the Builder.

Data.Builder
putBoolean(@NonNull key: String, value: Boolean)

Puts a boolean into the arguments.

Data.Builder
putBooleanArray(@NonNull key: String, @NonNull value: BooleanArray)

Puts a boolean array into the arguments.

Data.Builder
putByte(@NonNull key: String, value: Byte)

Puts an byte into the arguments.

Data.Builder
putByteArray(@NonNull key: String, @NonNull value: ByteArray)

Puts an integer array into the arguments.

Data.Builder
putDouble(@NonNull key: String, value: Double)

Puts a double into the arguments.

Data.Builder
putDoubleArray(@NonNull key: String, @NonNull value: DoubleArray)

Puts a double array into the arguments.

Data.Builder
putFloat(@NonNull key: String, value: Float)

Puts a float into the arguments.

Data.Builder
putFloatArray(@NonNull key: String, @NonNull value: FloatArray)

Puts a float array into the arguments.

Data.Builder
putInt(@NonNull key: String, value: Int)

Puts an integer into the arguments.

Data.Builder
putIntArray(@NonNull key: String, @NonNull value: IntArray)

Puts an integer array into the arguments.

Data.Builder
putLong(@NonNull key: String, value: Long)

Puts a long into the arguments.

Data.Builder
putLongArray(@NonNull key: String, @NonNull value: LongArray)

Puts a long array into the arguments.

Data.Builder
putString(@NonNull key: String, @Nullable value: String?)

Puts a String into the arguments.

Data.Builder
putStringArray(@NonNull key: String, @NonNull value: Array<String!>)

Puts a String array into the arguments.

Public constructors

<init>

Builder()

A builder for Data objects.

Public methods

build

@NonNull fun build(): Data

Builds a Data object.

Return
Data The Data object containing all key-value pairs specified by this Builder.

putAll

@NonNull fun putAll(@NonNull data: Data): Data.Builder

Puts all input key-value pairs from a Data into the Builder.

Valid value types are: Boolean, Integer, Long, Float, Double, String, and their array versions. Invalid types will throw an IllegalArgumentException.

Parameters
data Data: Data containing key-value pairs to add
Return
Data.Builder The Builder

putAll

@NonNull fun putAll(@NonNull values: MutableMap<String!, Any!>): Data.Builder

Puts all input key-value pairs from a Map into the Builder.

Valid value types are: Boolean, Integer, Long, Float, Double, String, and their array versions. Invalid types will throw an IllegalArgumentException.

Parameters
values MutableMap<String!, Any!>: A Map of key-value pairs to add
Return
Data.Builder The Builder

putBoolean

@NonNull fun putBoolean(
    @NonNull key: String,
    value: Boolean
): Data.Builder

Puts a boolean into the arguments.

Parameters
key String: The key for this argument
value Boolean: The value for this argument
Return
Data.Builder The Builder

putBooleanArray

@NonNull fun putBooleanArray(
    @NonNull key: String,
    @NonNull value: BooleanArray
): Data.Builder

Puts a boolean array into the arguments.

Parameters
key String: The key for this argument
value BooleanArray: The value for this argument
Return
Data.Builder The Builder

putByte

@NonNull fun putByte(
    @NonNull key: String,
    value: Byte
): Data.Builder

Puts an byte into the arguments.

Parameters
key String: The key for this argument
value Byte: The value for this argument
Return
Data.Builder The Builder

putByteArray

@NonNull fun putByteArray(
    @NonNull key: String,
    @NonNull value: ByteArray
): Data.Builder

Puts an integer array into the arguments.

Parameters
key String: The key for this argument
value ByteArray: The value for this argument
Return
Data.Builder The Builder

putDouble

@NonNull fun putDouble(
    @NonNull key: String,
    value: Double
): Data.Builder

Puts a double into the arguments.

Parameters
key String: The key for this argument
value Double: The value for this argument
Return
Data.Builder The Builder

putDoubleArray

@NonNull fun putDoubleArray(
    @NonNull key: String,
    @NonNull value: DoubleArray
): Data.Builder

Puts a double array into the arguments.

Parameters
key String: The key for this argument
value DoubleArray: The value for this argument
Return
Data.Builder The Builder

putFloat

@NonNull fun putFloat(
    @NonNull key: String,
    value: Float
): Data.Builder

Puts a float into the arguments.

Parameters
key String: The key for this argument
value Float: The value for this argument
Return
Data.Builder The Builder

putFloatArray

@NonNull fun putFloatArray(
    @NonNull key: String,
    @NonNull value: FloatArray
): Data.Builder

Puts a float array into the arguments.

Parameters
key String: The key for this argument
value FloatArray: The value for this argument
Return
Data.Builder The Builder

putInt

@NonNull fun putInt(
    @NonNull key: String,
    value: Int
): Data.Builder

Puts an integer into the arguments.

Parameters
key String: The key for this argument
value Int: The value for this argument
Return
Data.Builder The Builder

putIntArray

@NonNull fun putIntArray(
    @NonNull key: String,
    @NonNull value: IntArray
): Data.Builder

Puts an integer array into the arguments.

Parameters
key String: The key for this argument
value IntArray: The value for this argument
Return
Data.Builder The Builder

putLong

@NonNull fun putLong(
    @NonNull key: String,
    value: Long
): Data.Builder

Puts a long into the arguments.

Parameters
key String: The key for this argument
value Long: The value for this argument
Return
Data.Builder The Builder

putLongArray

@NonNull fun putLongArray(
    @NonNull key: String,
    @NonNull value: LongArray
): Data.Builder

Puts a long array into the arguments.

Parameters
key String: The key for this argument
value LongArray: The value for this argument
Return
Data.Builder The Builder

putString

@NonNull fun putString(
    @NonNull key: String,
    @Nullable value: String?
): Data.Builder

Puts a String into the arguments.

Parameters
key String: The key for this argument
value String?: The value for this argument
Return
Data.Builder The Builder

putStringArray

@NonNull fun putStringArray(
    @NonNull key: String,
    @NonNull value: Array<String!>
): Data.Builder

Puts a String array into the arguments.

Parameters
key String: The key for this argument
value Array<String!>: The value for this argument
Return
Data.Builder The Builder