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 interface StreamingOutput.
    Once an OutputTuple 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 a OutputTuple 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 from sourceTuple.
      void assignTuple(int attributeIndex, Tuple tuple)
      Assign attributes of a nested tuple attribute from matching attributes in a Tuple.
      void assignTuple(java.lang.String attributeName, Tuple tuple)
      Set the attribute as a TUPLE by attribute name by assigning matching attributes from tuple.
      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>> 
      void
      setEnum(java.lang.Class<E> enumType, int attributeIndex, E value)
      Set an enum attribute as an enumeration.
      <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.
      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 a Tuple.
      void setTuple(java.lang.String attributeName, Tuple value)
      Set the attribute as a TUPLE by attribute name.
      void setXML(int attributeIndex, XML value)
      Set an XML attribute as a XML.
      void setXML(java.lang.String attributeName, XML value)
      Set the attribute as a XML by attribute name.
    • 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 type LIST and BLIST.
        The passed in List is never modified.
        For SPL list types that have a Java array object type (for example list<int8>) a copy of list is made, changes to list do not change the value of this tuple's attribute.
        For all other SPL list types, changes to list 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, see BoundedType.

        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 type SET and BSET.

        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, see BoundedType.

        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 type MAP and BMAP.

        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, see BoundedType.

        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 type BLOB.
        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 from sourceTuple. Attributes match if their name and type are equal, regardless of index within the schemas.
        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 type BOOLEAN.
        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 type INT8, 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 type INT16, INT32 and 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 short.
      • setInt

        void setInt(int attributeIndex,
                  int value)
        Set an attribute as a primitive int. Only supported for attributes of type INT32 and 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 an int.
      • setLong

        void setLong(int attributeIndex,
                   long value)
        Set an attribute as a primitive long. Only supported for attributes of type 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 long.
      • setFloat

        void setFloat(int attributeIndex,
                    float value)
        Set an attribute as a primitive float. Only supported for attributes of type FLOAT32 and FLOAT64.
        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 type FLOAT64.
        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 type DECIMAL32, DECIMAL64, DECIMAL128. The attribute will be set to passed in value rounded according to its SPL type using the corresponding object from java.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 type USTRING and RSTRING (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 type TIMESTAMP.
        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 a XML. Only supported for attributes of type XML.
        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 a XML
        Since:
        InfoSphere® Streams Version 3.0
      • setTuple

        void setTuple(int attributeIndex,
                    Tuple value)
        Set a nested tuple attribute as a Tuple. Only supported for attributes of type TUPLE.
        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() for tuple is not equal to TupleType.getTupleSchema() for the attribute.
        java.lang.UnsupportedOperationException - Attribute value cannot be set from a Tuple
        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 a Tuple. Only supported for attributes of type TUPLE.
        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 from tuple. 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 a Tuple
        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 an enum attribute as an enumeration. Only supported for attributes of type ENUM.
        Type Parameters:
        E - Enumeration type
        Parameters:
        enumType - Class of the enumeration type E.
        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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        list - 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 set
        set - 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 set
        map - 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 set
        blob - Value to set attribute to.
        See Also:
        setBlob(int, Blob)
      • setXML

        void setXML(java.lang.String attributeName,
                  XML value)
        Set the attribute as a XML by attribute name.
        Parameters:
        attributeName - name of attribute to set
        value - 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 a TUPLE by attribute name.
        Parameters:
        attributeName - name of attribute to set
        value - 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 a TUPLE by attribute name by assigning matching attributes from tuple.
        Parameters:
        attributeName - name of attribute to set
        tuple - 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 type E.
        attributeName - name of attribute to set
        value - 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 this OutputTuple do not modified the returned Tuple.
        Specified by:
        asReadOnlyTuple in interface Tuple
        Returns:
        Read-only copy of this tuple.