com.ibm.streams.operator
Interface OutputTuple
-
- All Superinterfaces:
- Tuple
public interface OutputTuple extends Tuple
A mutable object that represents a tuple that can be submitted on an output port using the interfaceStreamingOutput.
Once anOutputTupleis submitted, any modification to it will not modify the version of the tuple seen by operators consuming the stream it was submitted to. This allows a reuse of aOutputTuplefor multiple submissions, modifying its value before each submit.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description TupleasReadOnlyTuple()Get an immutable version of this tuple.voidassign(Tuple sourceTuple)Set attributes of this tuple that have a matching attribute fromsourceTuple.voidassignTuple(int attributeIndex, Tuple tuple)Assign attributes of a nested tuple attribute from matching attributes in aTuple.voidassignTuple(java.lang.String attributeName, Tuple tuple)Set the attribute as aTUPLEby attribute name by assigning matching attributes fromtuple.voidsetBigDecimal(int attributeIndex, java.math.BigDecimal value)Set an attribute as a BigDecimal.voidsetBigDecimal(java.lang.String attributeName, java.math.BigDecimal value)Set the attribute as a BigDecimal by attribute name.voidsetBlob(int attributeIndex, Blob blob)Set an attribute as a Blob.voidsetBlob(java.lang.String attributeName, Blob blob)Set the attribute as a Blob by attribute name.voidsetBoolean(int attributeIndex, boolean value)Set an attribute as a primitive boolean.voidsetBoolean(java.lang.String attributeName, boolean value)Set the attribute as a boolean by attribute name.voidsetByte(int attributeIndex, byte value)Set an attribute as a primitive byte.voidsetByte(java.lang.String attributeName, byte value)Set the attribute as a byte by attribute name.voidsetDouble(int attributeIndex, double value)Set an attribute as a primitive double.voidsetDouble(java.lang.String attributeName, double value)Set the attribute as a double by attribute name.<E extends java.lang.Enum<E>>
voidsetEnum(java.lang.Class<E> enumType, int attributeIndex, E value)Set anenumattribute as an enumeration.<E extends java.lang.Enum<E>>
voidsetEnum(java.lang.Class<E> enumType, java.lang.String attributeName, E value)Set the attribute as a enumeration by attribute name.voidsetFloat(int attributeIndex, float value)Set an attribute as a primitive float.voidsetFloat(java.lang.String attributeName, float value)Set the attribute as a float by attribute name.voidsetInt(int attributeIndex, int value)Set an attribute as a primitive int.voidsetInt(java.lang.String attributeName, int value)Set the attribute as an int by attribute name.voidsetList(int attributeIndex, java.util.List<?> list)Set an attribute as a List.voidsetList(java.lang.String attributeName, java.util.List<?> list)Set the attribute as a List by attribute name.voidsetLong(int attributeIndex, long value)Set an attribute as a primitive long.voidsetLong(java.lang.String attributeName, long value)Set the attribute as a long by attribute name.voidsetMap(int attributeIndex, java.util.Map<?,?> map)Set an attribute as a Map.voidsetMap(java.lang.String attributeName, java.util.Map<?,?> map)Set the attribute as a Map by attribute name.voidsetNull(int attributeIndex)Set an optional attribute value to null (the value is not present).voidsetNull(java.lang.String attributeName)Set an optional attribute value to null (the value is not present) by attribute name.voidsetObject(int attributeIndex, java.lang.Object value)Set the value of the attribute at the given index.voidsetObject(java.lang.String attributeName, java.lang.Object value)Set the attribute as an Object by attribute name.voidsetOptional(int attributeIndex, java.util.Optional<?> optional)Set an optional attribute value using an Optional container.voidsetOptional(java.lang.String attributeName, java.util.Optional<?> optional)Set an optional attribute value using an Optional container by attribute name.voidsetSet(int attributeIndex, java.util.Set<?> set)Set an attribute as a Set.voidsetSet(java.lang.String attributeName, java.util.Set<?> set)Set the attribute as a Set by attribute name.voidsetShort(int attributeIndex, short value)Set an attribute as a primitive short.voidsetShort(java.lang.String attributeName, short value)Set the attribute as a short by attribute name.voidsetString(int attributeIndex, java.lang.String value)Set an attribute as a String.voidsetString(java.lang.String attributeName, java.lang.String value)Set the attribute as a String by attribute name.voidsetTimestamp(int attributeIndex, Timestamp value)Set an attribute as a Timestamp.voidsetTimestamp(java.lang.String attributeName, Timestamp value)Set the attribute as a Timestamp by attribute name.voidsetTuple(int attributeIndex, Tuple value)Set a nested tuple attribute as aTuple.voidsetTuple(java.lang.String attributeName, Tuple value)Set the attribute as aTUPLEby attribute name.voidsetXML(int attributeIndex, XML value)Set an XML attribute as aXML.voidsetXML(java.lang.String attributeName, XML value)Set the attribute as aXMLby attribute name.-
Methods inherited from interface com.ibm.streams.operator.Tuple
getBigDecimal, getBigDecimal, getBlob, getBlob, getBoolean, getBoolean, getBuffer, getBuffer, getBuffer, getBuffer, getByte, getByte, getDouble, getDouble, getEnum, getEnum, getFloat, getFloat, getInt, getInt, getList, getList, getLong, getLong, getMap, getMap, getObject, getObject, getObject, getObject, getOptional, getOptional, getSet, getSet, getShort, getShort, getStreamSchema, getString, getString, getTimestamp, getTimestamp, getTuple, getTuple, getXML, getXML
-
-
-
-
Method Detail
-
setObject
void setObject(int attributeIndex, java.lang.Object value)Set the value of the attribute at the given index. The class of the object must match exactly the SPL mapping for the type. For mutable value types, such as Java arrays, care must be taken not to modify the value after it has been passed to OutputTuple.setObject(), otherwise changes to the object will also change the state of OutputTuple.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to, or null to set the value of an optional type to not present.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from the value- See Also:
StreamSchema
-
setList
void setList(int attributeIndex, java.util.List<?> list)Set an attribute as a List. Only supported for attributes of, or attributes with optional values of, typesLISTandBLIST.
The passed in List is never modified.
For SPL list types that have a Java array object type (for examplelist<int8>) a copy oflistis made, changes tolistdo not change the value of this tuple's attribute.
For all other SPL list types, changes tolistdo change the value of this tuple's attribute.For bounded lists (
BLIST) excess elements beyond the bound are ignored. This matches SPL's semantics for bounded types, seeBoundedType.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.list- Value to set the attribute to, or null to set the value of an optional list to not present.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a List.
-
setSet
void setSet(int attributeIndex, java.util.Set<?> set)Set an attribute as a Set. Only supported for attributes of, or attributes with optional values of, typesSETandBSET.For bounded sets (
BSET) excess elements beyond the bound are ignored, though no guarantee is made as to which elements are set for the tuple. This matches SPL's semantics for bounded types, seeBoundedType.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.set- Value to set the attribute to, or null to set the value of an optional set to not present.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a Set.
-
setMap
void setMap(int attributeIndex, java.util.Map<?,?> map)Set an attribute as a Map. Only supported for attributes of, or attributes with optional values of, typesMAPandBMAP.For bounded sets (
BMAP) excess elements beyond the bound are ignored, though no guarantee is made as to which elements are set for the tuple. This matches SPL's semantics for bounded types, seeBoundedType.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.map- Value to set the attribute to, or null to set the value of an optional map to not present.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a Map.
-
setOptional
void setOptional(int attributeIndex, java.util.Optional<?> optional)Set an optional attribute value using an Optional container. Only supported for attributes of typeOPTIONAL. The type of the optional value, if present, must match thevalue typeof the attribute's optional value.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.optional- Optional container containing the value to set the attribute to, or an empty Optional to set the value to not present.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from an Optional.- Since:
- IBM® Streams Version 4.3
-
setNull
void setNull(int attributeIndex)
Set an optional attribute value to null (the value is not present). Only supported for attributes of typeOPTIONAL.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.- Throws:
java.lang.UnsupportedOperationException- Attribute cannot be set to null.- Since:
- IBM® Streams Version 4.3
-
setBlob
void setBlob(int attributeIndex, Blob blob)Set an attribute as a Blob. Only supported for attributes of, or attributes with optional values of, typeBLOB.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.blob- Value to set the attribute to, or null to set the value of an optional blob to not present.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a Blob.
-
assign
void assign(Tuple sourceTuple)
Set attributes of this tuple that have a matching attribute fromsourceTuple. Attributes match if theirnameandtypematch, regardless ofindexwithin theschemas. The type matches if the type of the source tuple attribute is the same as the type in this tuple, or is the same as the underlying type of an optional type in this tuple.- Parameters:
sourceTuple- Tuple to set my attributes from.- See Also:
StreamSchema.getTuple(Tuple)
-
setBoolean
void setBoolean(int attributeIndex, boolean value)Set an attribute as a primitive boolean. Only supported for attributes of, or attributes with optional values of, typeBOOLEAN.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a boolean.
-
setByte
void setByte(int attributeIndex, byte value)Set an attribute as a primitive byte. Only supported for attributes of, or attributes with optional values of, typesINT8,INT16,INT32,INT64.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a byte.
-
setShort
void setShort(int attributeIndex, short value)Set an attribute as a primitive short. Only supported for attributes of, or attributes with optional values of, typesINT16,INT32andINT64.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a short.
-
setInt
void setInt(int attributeIndex, int value)Set an attribute as a primitive int. Only supported for attributes of, or attributes with optional values of, typesINT32andINT64.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from an int.
-
setLong
void setLong(int attributeIndex, long value)Set an attribute as a primitive long. Only supported for attributes of, or attributes with optional values of, typeINT64.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a long.
-
setFloat
void setFloat(int attributeIndex, float value)Set an attribute as a primitive float. Only supported for attributes of, or attributes with optional values of, typesFLOAT32andFLOAT64.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a float.
-
setDouble
void setDouble(int attributeIndex, double value)Set an attribute as a primitive double. Only supported for attributes of, or attributes with optional values of, typeFLOAT64.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a double.
-
setBigDecimal
void setBigDecimal(int attributeIndex, java.math.BigDecimal value)Set an attribute as a BigDecimal. Only supported for attributes of typesDECIMAL32,DECIMAL64,DECIMAL128. The attribute will be set to passed in value rounded according to its SPL type using the corresponding object fromjava.math.MathContext.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to, or null to set the value of an optional decimal to not present.- Throws:
java.lang.ArithmeticException- Value is out of range for the SPL type.java.lang.UnsupportedOperationException- Attribute value cannot be set from a BigDecimal.
-
setString
void setString(int attributeIndex, java.lang.String value)Set an attribute as a String. Only supported for attributes of, or attributes with optional values of, typesUSTRINGandRSTRING(using UTF-8 encoding).- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to, or null to set the value of an optional string to not present.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a String
-
setTimestamp
void setTimestamp(int attributeIndex, Timestamp value)Set an attribute as a Timestamp. Only supported for attributes of, or attributes with optional values of, typeTIMESTAMP.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to, or null to set the value of an optional timestamp to not present.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from a Timestamp
-
setXML
void setXML(int attributeIndex, XML value)Set an XML attribute as aXML. Only supported for attributes of, or attributes with optional values of, typeXML.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to, or null to set the value of an optional XML value to not present.- Throws:
java.lang.IllegalArgumentException- Value is not the default value and is not well formed.java.lang.UnsupportedOperationException- Attribute value cannot be set from aXML- Since:
- InfoSphere® Streams Version 3.0
-
setTuple
void setTuple(int attributeIndex, Tuple value)Set a nested tuple attribute as aTuple. Only supported for attributes of, or attributes with optional values of, typeTUPLE.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to, or null to set the value of an optional tuple to not present.- Throws:
java.lang.IllegalArgumentException-Tuple.getStreamSchema()fortupleis not equal toTupleType.getTupleSchema()for the attribute.java.lang.UnsupportedOperationException- Attribute value cannot be set from aTuple- Since:
- InfoSphere® Streams Version 3.0
- See Also:
TupleType
-
assignTuple
void assignTuple(int attributeIndex, Tuple tuple)Assign attributes of a nested tuple attribute from matching attributes in aTuple. Only supported for attributes of, or attributes with optional values of, typeTUPLE.- Parameters:
attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.tuple- The embedded tuple will have any matching attributes set fromtuple. The attribute name and type must match. The type matches if the type of the source tuple attribute is the same as the type in the nested tuple, or is the same as the underlying type of an optional type in the nested tuple. Any attributes in the embedded tuple's schema for which there is no matching name and type will be set to the default value.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from aTuple- Since:
- InfoSphere® Streams Version 3.0
- See Also:
StreamSchema.getTuple(Tuple),TupleType
-
setEnum
<E extends java.lang.Enum<E>> void setEnum(java.lang.Class<E> enumType, int attributeIndex, E value)Set anenumattribute as an enumeration. Only supported for attributes of, or attributes with optional values of, typeENUM.- Type Parameters:
E- Enumeration type- Parameters:
enumType- Class of the enumeration typeE.attributeIndex- Index of attribute to be set, zero is the tuple's first attribute.value- Value to set the attribute to, or null to set the value of an optional enum to not present.- Throws:
java.lang.UnsupportedOperationException- Attribute value cannot be set from the enumeration value- Since:
- InfoSphere® Streams Version 3.0
- See Also:
EnumType
-
setBoolean
void setBoolean(java.lang.String attributeName, boolean value)Set the attribute as a boolean by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to.- See Also:
setBoolean(int, boolean)
-
setByte
void setByte(java.lang.String attributeName, byte value)Set the attribute as a byte by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to.- See Also:
setByte(int, byte)
-
setShort
void setShort(java.lang.String attributeName, short value)Set the attribute as a short by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to.- See Also:
setShort(int, short)
-
setInt
void setInt(java.lang.String attributeName, int value)Set the attribute as an int by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to.- See Also:
setInt(int, int)
-
setLong
void setLong(java.lang.String attributeName, long value)Set the attribute as a long by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to.- See Also:
setLong(int, long)
-
setFloat
void setFloat(java.lang.String attributeName, float value)Set the attribute as a float by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to.- See Also:
setFloat(int, float)
-
setDouble
void setDouble(java.lang.String attributeName, double value)Set the attribute as a double by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to.- See Also:
setDouble(int, double)
-
setBigDecimal
void setBigDecimal(java.lang.String attributeName, java.math.BigDecimal value)Set the attribute as a BigDecimal by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to, or null to set the value of an optional type to not present.- See Also:
setBigDecimal(int, BigDecimal)
-
setString
void setString(java.lang.String attributeName, java.lang.String value)Set the attribute as a String by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to, or null to set the value of an optional type to not present.- See Also:
setString(int, String)
-
setTimestamp
void setTimestamp(java.lang.String attributeName, Timestamp value)Set the attribute as a Timestamp by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to, or null to set the value of an optional type to not present.- See Also:
setTimestamp(int, Timestamp)
-
setObject
void setObject(java.lang.String attributeName, java.lang.Object value)Set the attribute as an Object by attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to, or null to set the value of an optional type to not present.- See Also:
setObject(int, Object)
-
setList
void setList(java.lang.String attributeName, java.util.List<?> list)Set the attribute as a List by attribute name.- Parameters:
attributeName- name of attribute to setlist- Value to set the attribute to, or null to set the value of an optional type to not present.- See Also:
setList(int, List)
-
setSet
void setSet(java.lang.String attributeName, java.util.Set<?> set)Set the attribute as a Set by attribute name.- Parameters:
attributeName- name of attribute to setset- Value to set the attribute to, or null to set the value of an optional type to not present.- See Also:
setSet(int, Set)
-
setMap
void setMap(java.lang.String attributeName, java.util.Map<?,?> map)Set the attribute as a Map by attribute name.- Parameters:
attributeName- name of attribute to setmap- Value to set the attribute to, or null to set the value of an optional type to not present.- See Also:
setMap(int, Map)
-
setOptional
void setOptional(java.lang.String attributeName, java.util.Optional<?> optional)Set an optional attribute value using an Optional container by attribute name.- Parameters:
attributeName- name of attribute to setoptional- Optional container containing the value to set the attribute to, or an empty Optional to set the value to not present.- Since:
- IBM® Streams Version 4.3
- See Also:
setOptional(int, Optional)
-
setNull
void setNull(java.lang.String attributeName)
Set an optional attribute value to null (the value is not present) by attribute name.- Parameters:
attributeName- name of attribute to set- See Also:
setNull(int)
-
setBlob
void setBlob(java.lang.String attributeName, Blob blob)Set the attribute as a Blob by attribute name.- Parameters:
attributeName- name of attribute to setblob- Value to set the attribute to, or null to set the value of an optional type to not present.- See Also:
setBlob(int, Blob)
-
setXML
void setXML(java.lang.String attributeName, XML value)Set the attribute as aXMLby attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to, or null to set the value of an optional type to not present.- Since:
- InfoSphere® Streams Version 3.0
- See Also:
setXML(int, XML)
-
setTuple
void setTuple(java.lang.String attributeName, Tuple value)Set the attribute as aTUPLEby attribute name.- Parameters:
attributeName- name of attribute to setvalue- Value to set the attribute to, or null to set the value of an optional type to not present.- Since:
- InfoSphere® Streams Version 3.0
- See Also:
setTuple(int, Tuple)
-
assignTuple
void assignTuple(java.lang.String attributeName, Tuple tuple)Set the attribute as aTUPLEby attribute name by assigning matching attributes fromtuple.- Parameters:
attributeName- name of attribute to settuple- Tuple to assign attributes from.- Since:
- InfoSphere® Streams Version 3.0
- See Also:
assignTuple(int, Tuple)
-
setEnum
<E extends java.lang.Enum<E>> void setEnum(java.lang.Class<E> enumType, java.lang.String attributeName, E value)Set the attribute as a enumeration by attribute name.- Type Parameters:
E- Enumeration type- Parameters:
enumType- Class of the enumeration typeE.attributeName- name of attribute to setvalue- Value to set the attribute to, or null to set the value of an optional type to not present.- Since:
- InfoSphere® Streams Version 3.0
- See Also:
setEnum(Class, int, Enum),EnumType
-
asReadOnlyTuple
Tuple asReadOnlyTuple()
Get an immutable version of this tuple. Future changes to thisOutputTupledo not modified the returnedTuple.- Specified by:
asReadOnlyTuplein interfaceTuple- Returns:
- Read-only copy of this tuple.
-
-