public class Data
extends java.lang.Object
implements java.io.Serializable
Class for encapsulating data to be transferred between Knowledge Flow steps over a particular connection type. Typical usage involves constructing a Data object with a given connection name and then setting one or more pieces of "payload" data to encapsulate. Usually there is a primary payload that is associated with the connection name itself (there is a constructor that takes both the connection name and the primary payload data). Further auxiliary data items can be added via the setPayloadElement() method.
Standard connection types are defined as constants in the StepManager class. There is nothing to prevent clients from using their own connection types (as these are just string identifiers).
Typical usage in a client step (transferring an training instances object):Instances train = ... Data myData = new Data(StepManager.CON_TRAININGSET, train); getStepManager().outputData(myData);
Constructor and Description |
---|
Data()
Empty constructor - no connection name; no payload
|
Data(java.lang.String connectionName)
Construct a Data object with just a connection name
|
Data(java.lang.String connectionName,
java.lang.Object primaryPayload)
Construct a Data object with a connection name and a primary payload object
to associate with the connection name
|
Modifier and Type | Method and Description |
---|---|
void |
clearPayload()
Clear all payload elements from this Data object
|
java.lang.String |
getConnectionName()
Get the connection name associated with this Data object
|
<T> T |
getPayloadElement(java.lang.String name)
Get a payload element from this Data object.
|
<T> T |
getPayloadElement(java.lang.String name,
T defaultValue)
Get a payload element from this Data object.
|
<T> T |
getPrimaryPayload()
Get the primary payload of this data object (i.e.
|
Step |
getSourceStep()
Get the source step producing this Data object
|
boolean |
isIncremental()
Return true if the connection specified for this data object is incremental
|
void |
setConnectionName(java.lang.String name)
Set the connection name for this Data object
|
void |
setPayloadElement(java.lang.String name,
java.lang.Object value)
Set a payload element to encapsulate in this Data object.
|
void |
setSourceStep(Step sourceStep)
Set the source step of producing this Data object
|
public Data()
public Data(java.lang.String connectionName)
connectionName
- the connection namepublic Data(java.lang.String connectionName, java.lang.Object primaryPayload)
connectionName
- connection nameprimaryPayload
- primary payload object (i.e. is keyed against the
connection name)public void setSourceStep(Step sourceStep)
sourceStep
- the source steppublic Step getSourceStep()
public void setConnectionName(java.lang.String name)
name
- the name of the connectionpublic java.lang.String getConnectionName()
public <T> T getPrimaryPayload()
T
- the type of the primary payloadpublic <T> T getPayloadElement(java.lang.String name)
name
- the name of the payload element to getpublic <T> T getPayloadElement(java.lang.String name, T defaultValue)
T
- the type of the payload element to getname
- the name of the payload element to getdefaultValue
- a default value if the named element does not existpublic void setPayloadElement(java.lang.String name, java.lang.Object value)
name
- the name of the payload element to encapsulatevalue
- the value of the payload elementpublic void clearPayload()
public boolean isIncremental()