Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

InputMerger

abstract class InputMerger
kotlin.Any
   ↳ androidx.work.InputMerger

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(Data). 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

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

Public methods

abstract Data
merge(@NonNull inputs: MutableList<Data!>)

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

Public constructors

<init>

InputMerger()

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(Data). 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.

Public methods

merge

@NonNull abstract fun merge(@NonNull inputs: MutableList<Data!>): Data

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

Parameters
inputs MutableList<Data!>: A list of Data
Return
Data: The merged output