com.ibm.streams.operator

Interface TupleAttribute<T,A>



  • public interface TupleAttribute<T,A>
    Defines an attribute for a specific port. An Operator that requires an Attribute parameter must contain a property of this type.

    The setter method for the property of type TupleAttribute must then be annotated with the Parameter annotation. At operator initialization, the Java runtime will initialize the property with the attribute information as specified in the SPL application by calling its setter method.
    For example, an operator property can be specified as follows:

     
                    private TupleAttribute<Tuple,Integer> sortBy;
                    ...
                    @Parameter
                    public void setSortBy(TupleAttribute<Tuple,Integer> s) {
                            this.sortBy = s;
                    }       
     
     

    In an SPL application, the parameter can then be used as follows:
     
            param
           param1: s;
     
     
    where s is an attribute on an input stream of the operator.
    To specify a default attribute to be used with an Atribute parameter, specify the attribute name using the com.ibm.streams.operator.model.DefaultAttribute annotation.

    Since:
    InfoSphere® Streams Version 4.0
    See Also:
    Parameter, DefaultAttribute
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      Attribute getAttribute()
      A reference to the actual attribute object
      StreamingInput<T> getPort()
      The port whose schema includes the referenced attribute
      A getValue(T tuple)
      The value of the attribute in the specified tuple.
    • Method Detail

      • getPort

        StreamingInput<T> getPort()
        The port whose schema includes the referenced attribute
      • getAttribute

        Attribute getAttribute()
        A reference to the actual attribute object
      • getValue

        A getValue(T tuple)
        The value of the attribute in the specified tuple.
        Parameters:
        tuple - The tuple in which the attribute is to be located
        Returns:
        The value of the attribute in tuple T as type A