Data.Builder

public static final class Data.Builder
extends Object

java.lang.Object
   ↳ androidx.work.Data.Builder


A builder for Data.

Summary

Public constructors

Data.Builder()

Public methods

Data build()

Builds an Data object.

void putAll(Map<String, Object> values)

Puts all input key-value pairs into the Builder.

Data.Builder putAll(Data data)

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

Data.Builder putBoolean(String key, boolean value)

Puts a boolean into the arguments.

Data.Builder putBooleanArray(String key, boolean[] value)

Puts a boolean array into the arguments.

Data.Builder putDouble(String key, double value)

Puts a double into the arguments.

Data.Builder putDoubleArray(String key, double[] value)

Puts a double array into the arguments.

Data.Builder putFloat(String key, float value)

Puts a float into the arguments.

Data.Builder putFloatArray(String key, float[] value)

Puts a float array into the arguments.

Data.Builder putInt(String key, int value)

Puts an integer into the arguments.

Data.Builder putIntArray(String key, int[] value)

Puts an integer array into the arguments.

Data.Builder putLong(String key, long value)

Puts a long into the arguments.

Data.Builder putLongArray(String key, long[] value)

Puts a long array into the arguments.

Data.Builder putString(String key, String value)

Puts a String into the arguments.

Data.Builder putStringArray(String key, String[] value)

Puts a String array into the arguments.

Inherited methods

Public constructors

Data.Builder

Data.Builder ()

Public methods

build

Data build ()

Builds an Data object.

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

putAll

void putAll (Map<String, Object> values)

Puts all input key-value pairs into the Builder. Any non-valid types will be logged and ignored. Valid types are: Boolean, Integer, Long, Double, String, and array versions of each of those types. Any null values will also be ignored.

Parameters
values Map: A Map of key-value pairs to add

putAll

Data.Builder putAll (Data data)

Puts all input key-value pairs from the Data into the Builder. Any non-valid types will be logged and ignored. Valid types are: Boolean, Integer, Long, Double, String, and array versions of each of those types. Any null values will also be ignored.

Parameters
data Data: Data containing key-value pairs to add

Returns
Data.Builder The Data.Builder

putBoolean

Data.Builder putBoolean (String key, 
                boolean value)

Puts a boolean into the arguments.

Parameters
key String: The key for this argument

value boolean: The value for this argument

Returns
Data.Builder The Data.Builder

putBooleanArray

Data.Builder putBooleanArray (String key, 
                boolean[] value)

Puts a boolean array into the arguments.

Parameters
key String: The key for this argument

value boolean: The value for this argument

Returns
Data.Builder The Data.Builder

putDouble

Data.Builder putDouble (String key, 
                double value)

Puts a double into the arguments.

Parameters
key String: The key for this argument

value double: The value for this argument

Returns
Data.Builder The Data.Builder

putDoubleArray

Data.Builder putDoubleArray (String key, 
                double[] value)

Puts a double array into the arguments.

Parameters
key String: The key for this argument

value double: The value for this argument

Returns
Data.Builder The Data.Builder

putFloat

Data.Builder putFloat (String key, 
                float value)

Puts a float into the arguments.

Parameters
key String: The key for this argument

value float: The value for this argument

Returns
Data.Builder The Data.Builder

putFloatArray

Data.Builder putFloatArray (String key, 
                float[] value)

Puts a float array into the arguments.

Parameters
key String: The key for this argument

value float: The value for this argument

Returns
Data.Builder The Data.Builder

putInt

Data.Builder putInt (String key, 
                int value)

Puts an integer into the arguments.

Parameters
key String: The key for this argument

value int: The value for this argument

Returns
Data.Builder The Data.Builder

putIntArray

Data.Builder putIntArray (String key, 
                int[] value)

Puts an integer array into the arguments.

Parameters
key String: The key for this argument

value int: The value for this argument

Returns
Data.Builder The Data.Builder

putLong

Data.Builder putLong (String key, 
                long value)

Puts a long into the arguments.

Parameters
key String: The key for this argument

value long: The value for this argument

Returns
Data.Builder The Data.Builder

putLongArray

Data.Builder putLongArray (String key, 
                long[] value)

Puts a long array into the arguments.

Parameters
key String: The key for this argument

value long: The value for this argument

Returns
Data.Builder The Data.Builder

putString

Data.Builder putString (String key, 
                String value)

Puts a String into the arguments.

Parameters
key String: The key for this argument

value String: The value for this argument

Returns
Data.Builder The Data.Builder

putStringArray

Data.Builder putStringArray (String key, 
                String[] value)

Puts a String array into the arguments.

Parameters
key String: The key for this argument

value String: The value for this argument

Returns
Data.Builder The Data.Builder