InputMerger

abstract class InputMerger

Known direct subclasses
ArrayCreatingInputMerger

An InputMerger that attempts to merge the inputs, creating arrays when necessary.

OverwritingInputMerger

An InputMerger that attempts to add all keys from all inputs to the output.


An abstract class that allows the user to define how to merge a list of inputs to a ListenableWorker.

Before workers run, they receive input Data from their parent workers, as well as anything specified directly to them via WorkRequest.Builder.setInputData. An InputMerger takes all of these objects and converts them to a single merged Data to be used as the worker input. WorkManager offers two concrete InputMerger implementations: OverwritingInputMerger and ArrayCreatingInputMerger.

Note that the list of inputs to merge is in an unspecified order. You should not make assumptions about the order of inputs.

Summary

Public constructors

Public functions

abstract Data
merge(inputs: List<Data>)

Merges a list of Data and outputs a single Data object.

Public constructors

InputMerger

Added in 1.0.0
InputMerger()

Public functions

merge

Added in 1.0.0
abstract fun merge(inputs: List<Data>): Data

Merges a list of Data and outputs a single Data object.

Parameters
inputs: List<Data>

A list of Data

Returns
Data

The merged output