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

      All Methods Instance Methods Abstract 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 setNull(int attributeIndex)
      Set an optional attribute value to null (the value is not present).
      void setNull(java.lang.String attributeName)
      Set an optional attribute value to null (the value is not present) 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 setOptional(int attributeIndex, java.util.Optional<?> optional)
      Set an optional attribute value using an Optional container.
      void setOptional(java.lang.String attributeName, java.util.Optional<?> optional)
      Set an optional attribute value using an Optional container 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, 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, types 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, 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, types 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, 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, types 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, 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 type OPTIONAL. The type of the optional value, if present, must match the value type of 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 type OPTIONAL.
        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, type BLOB.
        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 from sourceTuple. Attributes match if their name and type match, regardless of index within the schemas. 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, 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, or attributes with optional values of, types 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, or attributes with optional values of, types 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, or attributes with optional values of, types 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, or attributes with optional values 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, or attributes with optional values of, types 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, or attributes with optional values 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 types 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, 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, types 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, 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, type TIMESTAMP.
        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 a XML. Only supported for attributes of, or attributes with optional values 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, 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 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, or attributes with optional values 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, or null to set the value of an optional tuple to not present.
        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, or attributes with optional values 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. 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 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, or attributes with optional values 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, 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        value - 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 set
        list - 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 set
        set - 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 set
        map - 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 set
        optional - 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 set
        blob - 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 a XML by attribute name.
        Parameters:
        attributeName - name of attribute to set
        value - 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 a TUPLE by attribute name.
        Parameters:
        attributeName - name of attribute to set
        value - 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 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 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 this OutputTuple do not modified the returned Tuple.
        Specified by:
        asReadOnlyTuple in interface Tuple
        Returns:
        Read-only copy of this tuple.