public class Inputs extends IODataObjects
TaskContext.getInputs() this class provides access to the data
objects associated by a task to the input slots of a worker. It can create different kinds of Input wrappers
on these data objects that make access for the workers easier. You can create only a single input wrapper for each
data object. On the second call, only null will be returned.StreamInput,
RecordInput,
KvoInput_dataObjects, _ioData| Constructor and Description |
|---|
Inputs(java.util.Map<java.lang.String,java.util.List<BulkInfo>> dataObjects,
ObjectStoreService objectStore)
create instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addInputCounters(java.util.Map<java.lang.String,java.lang.Number> counters)
aggregate counters of input slots.
|
void |
closeAll()
close all input wrapper objects.
|
<T extends Input> |
getAsInput(java.lang.String slotName,
java.lang.Class<T> inputClass)
Generic method to create input wrapper for the first data object in a slot.
|
<T extends Input> |
getAsInput(java.lang.String slotName,
int index,
java.lang.Class<T> inputClass)
Generic method to create input wrappers.
|
RecordInput |
getAsRecordInput(java.lang.String slotName) |
RecordInput |
getAsRecordInput(java.lang.String slotName,
int index) |
StreamInput |
getAsStreamInput(java.lang.String slotName) |
StreamInput |
getAsStreamInput(java.lang.String slotName,
int index) |
addCounters, canCreate, getDataObject, getDataObject, getDataObjectCount, getIOData, getObjectStore, putIODatapublic Inputs(java.util.Map<java.lang.String,java.util.List<BulkInfo>> dataObjects, ObjectStoreService objectStore)
public <T extends Input> T getAsInput(java.lang.String slotName, java.lang.Class<T> inputClass)
getAsInput(String, int, Class) for details, this method just calls this method with index = 0java.lang.IllegalArgumentException - if the inputClass cannot be instantiated.public <T extends Input> T getAsInput(java.lang.String slotName, int index, java.lang.Class<T> inputClass)
Input can be used as well as custom
defined class if you need it (be sure to implement the necessary constructor). For example, to get an
Key-Value-Object wrapper for the first object in slot "kvoInputSlot", use
KVOInput kvo = taskContext.getInputs().getAsInput("kvoInputSlot", KVOInput.class);java.lang.IllegalArgumentException - if the inputClass cannot be instantiated.StreamInput,
RecordInput,
KvoInputpublic StreamInput getAsStreamInput(java.lang.String slotName)
public StreamInput getAsStreamInput(java.lang.String slotName, int index)
public RecordInput getAsRecordInput(java.lang.String slotName)
public RecordInput getAsRecordInput(java.lang.String slotName, int index)
public void closeAll()
public void addInputCounters(java.util.Map<java.lang.String,java.lang.Number> counters)