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 anOutputTuple
is 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 aOutputTuple
for multiple submissions, modifying its value before each submit.
-
-
Method Summary
Methods Modifier and Type Method and Description Tuple
asReadOnlyTuple()
Get an immutable version of this tuple.void
assign(Tuple sourceTuple)
Set attributes of this tuple that have a matching attribute fromsourceTuple
.void
assignTuple(int attributeIndex, Tuple tuple)
Assign attributes of a nested tuple attribute from matching attributes in aTuple
.void
assignTuple(java.lang.String attributeName, Tuple tuple)
Set the attribute as aTUPLE
by attribute name by assigning matching attributes fromtuple
.void
setBigDecimal(int attributeIndex, java.math.BigDecimal value)
Set an attribute as a BigDecimal.void
setBigDecimal(java.lang.String attributeName, java.math.BigDecimal value)
Set the attribute as a BigDecimal by attribute name.void
setBlob(int attributeIndex, Blob blob)
Set an attribute as a Blob.void
setBlob(java.lang.String attributeName, Blob blob)
Set the attribute as a Blob by attribute name.void
setBoolean(int attributeIndex, boolean value)
Set an attribute as a primitive boolean.void
setBoolean(java.lang.String attributeName, boolean value)
Set the attribute as a boolean by attribute name.void
setByte(int attributeIndex, byte value)
Set an attribute as a primitive byte.void
setByte(java.lang.String attributeName, byte value)
Set the attribute as a byte by attribute name.void
setDouble(int attributeIndex, double value)
Set an attribute as a primitive double.void
setDouble(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 anenum
attribute 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.void
setFloat(int attributeIndex, float value)
Set an attribute as a primitive float.void
setFloat(java.lang.String attributeName, float value)
Set the attribute as a float by attribute name.void
setInt(int attributeIndex, int value)
Set an attribute as a primitive int.void
setInt(java.lang.String attributeName, int value)
Set the attribute as an int by attribute name.void
setList(int attributeIndex, java.util.List<?> list)
Set an attribute as a List.void
setList(java.lang.String attributeName, java.util.List<?> list)
Set the attribute as a List by attribute name.void
setLong(int attributeIndex, long value)
Set an attribute as a primitive long.void
setLong(java.lang.String attributeName, long value)
Set the attribute as a long by attribute name.void
setMap(int attributeIndex, java.util.Map<?,?> map)
Set an attribute as a Map.void
setMap(java.lang.String attributeName, java.util.Map<?,?> map)
Set the attribute as a Map by attribute name.void
setObject(int attributeIndex, java.lang.Object value)
Set the value of the attribute at the given index.void
setObject(java.lang.String attributeName, java.lang.Object value)
Set the attribute as an Object by attribute name.void
setSet(int attributeIndex, java.util.Set<?> set)
Set an attribute as a Set.void
setSet(java.lang.String attributeName, java.util.Set<?> set)
Set the attribute as a Set by attribute name.void
setShort(int attributeIndex, short value)
Set an attribute as a primitive short.void
setShort(java.lang.String attributeName, short value)
Set the attribute as a short by attribute name.void
setString(int attributeIndex, java.lang.String value)
Set an attribute as a String.void
setString(java.lang.String attributeName, java.lang.String value)
Set the attribute as a String by attribute name.void
setTimestamp(int attributeIndex, Timestamp value)
Set an attribute as a Timestamp.void
setTimestamp(java.lang.String attributeName, Timestamp value)
Set the attribute as a Timestamp by attribute name.void
setTuple(int attributeIndex, Tuple value)
Set a nested tuple attribute as aTuple
.void
setTuple(java.lang.String attributeName, Tuple value)
Set the attribute as aTUPLE
by attribute name.void
setXML(int attributeIndex, XML value)
Set an XML attribute as aXML
.void
setXML(java.lang.String attributeName, XML value)
Set the attribute as aXML
by 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, 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.- 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 typeLIST
andBLIST
.
The passed in List is never modified.
For SPL list types that have a Java array object type (for examplelist<int8>
) a copy oflist
is made, changes tolist
do not change the value of this tuple's attribute.
For all other SPL list types, changes tolist
do 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.- 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 typeSET
andBSET
.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.- 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 typeMAP
andBMAP
.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.- Throws:
java.lang.UnsupportedOperationException
- Attribute value cannot be set from a Map.
-
setBlob
void setBlob(int attributeIndex, Blob blob)
Set an attribute as a Blob. Only supported for attributes of typeBLOB
.- Parameters:
attributeIndex
- Index of attribute to be set, zero is the tuple's first attribute.blob
- Value to set the attribute to.- 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 theirname
andtype
are equal, regardless ofindex
within theschemas
.- 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 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 typeINT8
,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 typeINT16
,INT32
andINT64
.- 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)
- 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 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)
- 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 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 typeDECIMAL32
,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.- 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 typeUSTRING
andRSTRING
(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.- 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 typeTIMESTAMP
.- 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 Timestamp
-
setXML
void setXML(int attributeIndex, XML value)
Set an XML attribute as aXML
. Only supported for attributes of typeXML
.- 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.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 typeTUPLE
.- 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.IllegalArgumentException
-Tuple.getStreamSchema()
fortuple
is 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 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
. Any non-matched attributes for the embedded tuple's schema 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 anenum
attribute as an enumeration. Only supported for attributes 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.- 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 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 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 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 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 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 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 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 attribute to.- 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 attribute to.- 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 attribute to.- 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 attribute to.- 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 attribute to.- 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 attribute to.- 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 attribute to.- See Also:
setMap(int, Map)
-
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 attribute to.- See Also:
setBlob(int, Blob)
-
setXML
void setXML(java.lang.String attributeName, XML value)
Set the attribute as aXML
by attribute name.- Parameters:
attributeName
- name of attribute to setvalue
- Value to set attribute to.- Since:
- InfoSphere® Streams Version 3.0
- See Also:
setXML(int, XML)
-
setTuple
void setTuple(java.lang.String attributeName, Tuple value)
Set the attribute as aTUPLE
by attribute name.- Parameters:
attributeName
- name of attribute to setvalue
- Value to set attribute to.- Since:
- InfoSphere® Streams Version 3.0
- See Also:
setTuple(int, Tuple)
-
assignTuple
void assignTuple(java.lang.String attributeName, Tuple tuple)
Set the attribute as aTUPLE
by 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 attribute to.- 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 thisOutputTuple
do not modified the returnedTuple
.- Specified by:
asReadOnlyTuple
in interfaceTuple
- Returns:
- Read-only copy of this tuple.
-
-