Data.Builder

public static final class Data.Builder
extends Object

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


A builder for Data objects.

Summary

Public constructors

Data.Builder()

Public methods

Data build()

Builds a Data object.

Data.Builder putAll(Map<String, Object> values)

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

Data.Builder putAll(Data data)

Puts all input key-value pairs from a 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

public Data.Builder ()

Public methods

build

public Data build ()

Builds a Data object.

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

putAll

public Data.Builder putAll (Map<String, Object> values)

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 Map: A Map of key-value pairs to add

Returns
Data.Builder The Data.Builder

putAll

public Data.Builder putAll (Data data)

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

Returns
Data.Builder The Data.Builder

putBoolean

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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