Package weka.knowledgeflow
Class Data
java.lang.Object
weka.knowledgeflow.Data
- All Implemented Interfaces:
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);
- Version:
- $Revision: $
- Author:
- mhall{[at]}pentaho{[dot]}com
- See Also:
-
Constructor Summary
ConstructorDescriptionData()
Empty constructor - no connection name; no payloadConstruct a Data object with just a connection nameConstruct a Data object with a connection name and a primary payload object to associate with the connection name -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear all payload elements from this Data objectGet the connection name associated with this Data object<T> T
getPayloadElement
(String name) Get a payload element from this Data object.<T> T
getPayloadElement
(String name, T defaultValue) Get a payload element from this Data object.<T> T
Get the primary payload of this data object (i.e.Get the source step producing this Data objectboolean
Return true if the connection specified for this data object is incrementalvoid
setConnectionName
(String name) Set the connection name for this Data objectvoid
setPayloadElement
(String name, 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
-
Constructor Details
-
Data
public Data()Empty constructor - no connection name; no payload -
Data
Construct a Data object with just a connection name- Parameters:
connectionName
- the connection name
-
Data
Construct a Data object with a connection name and a primary payload object to associate with the connection name- Parameters:
connectionName
- connection nameprimaryPayload
- primary payload object (i.e. is keyed against the connection name)
-
-
Method Details
-
setSourceStep
Set the source step of producing this Data object- Parameters:
sourceStep
- the source step
-
getSourceStep
Get the source step producing this Data object- Returns:
- the source step producing the data object
-
setConnectionName
Set the connection name for this Data object- Parameters:
name
- the name of the connection
-
getConnectionName
Get the connection name associated with this Data object- Returns:
- the connection name
-
getPrimaryPayload
public <T> T getPrimaryPayload()Get the primary payload of this data object (i.e. the data associated with the connection name)- Type Parameters:
T
- the type of the primary payload- Returns:
- the primary payload data (or null if there is no data associated with the connection)
-
getPayloadElement
Get a payload element from this Data object. Standard payload element names (keys) can be found as constants defined in the StepManager class.- Parameters:
name
- the name of the payload element to get- Returns:
- the named payload element, or null if it does not exist in this Data object
-
getPayloadElement
Get a payload element from this Data object. Standard payload element names (keys) can be found as constants defined in the StepManager class.- Type Parameters:
T
- the type of the payload element to get- Parameters:
name
- the name of the payload element to getdefaultValue
- a default value if the named element does not exist- Returns:
- the payload element, or the supplied default value.
-
setPayloadElement
Set a payload element to encapsulate in this Data object. Standard payload element names (keys) can be found as constants defined in the StepManager class.- Parameters:
name
- the name of the payload element to encapsulatevalue
- the value of the payload element
-
clearPayload
public void clearPayload()Clear all payload elements from this Data object -
isIncremental
public boolean isIncremental()Return true if the connection specified for this data object is incremental- Returns:
- true if the connection for this data object is incremental
-