InputMerger


public 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 methods

abstract @NonNull Data

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

Public constructors

InputMerger

Added in 1.0.0
public InputMerger()

Public methods

merge

Added in 1.0.0
public abstract @NonNull Data merge(@NonNull List<@NonNull Data> inputs)

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

Parameters
@NonNull List<@NonNull Data> inputs

A list of Data

Returns
@NonNull Data

The merged output