com.streambase.sb.unittest

## Class ObjectArrayTupleMaker

- java.lang.Object
- - com.streambase.sb.unittest.AbstractTupleMaker<Object[]>
  - - com.streambase.sb.unittest.ObjectArrayTupleMaker

- All Implemented Interfaces:
    TupleMaker<Object[]>

      public class ObjectArrayTupleMaker
      extends AbstractTupleMaker<Object[]>

  A factory to build `Tuple`s from Java objects. Accepts the same objects as `Tuple.setField(com.streambase.sb.Schema.Field, Object)`.

  Note that when passing `Tuple`s as value objects to an `Enqueuer` or `Dequeuer`, you may obtain the stream's schema from `Enqueuer.getSchema()` and `Dequeuer.getSchema()`

  For example, given a schema:

        id int,
        name string,
        values list(int),
        listofvalues list(list(int)),
        location tuple(zipcode int, state string),
        prevlocation tuple(zipcode int, state string)

  a valid invocation of `ObjectArrayTupleMaker.createTuple(Schema, Object[])` might look like:

        createTuple(schema, new Object[] { 1,
                                           "item1",
                                           Arrays.asList(10,20),
                                           "[\"[30,40]\",\"[50,60]\"]",
                                           "2421, MA",
                                           s.getField(5).getSchema().createTuple("10036", "NY")
       });

  Since:
    6.6
  See Also:
    `Tuple.setField(com.streambase.sb.Schema.Field, Object)`, `TupleMaker`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ObjectArrayTupleMaker` | `MAKER` Static `ObjectArrayTupleMaker` instance suitable as argument to `Enqueuer` and `Expecter` methods that need a `TupleMaker`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObjectArrayTupleMaker()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Tuple` | `createTuple(Schema schema, Object[] objs)` create a `Tuple`s from an input object

    - ### Methods inherited from class com.streambase.sb.unittest.AbstractTupleMaker

      `createTuples, createTuples`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### MAKER

          public static final ObjectArrayTupleMaker MAKER

      Static `ObjectArrayTupleMaker` instance suitable as argument to `Enqueuer` and `Expecter` methods that need a `TupleMaker`
      See Also:
        `class documentation for example usage`

  - ### Constructor Detail

    - #### ObjectArrayTupleMaker

          public ObjectArrayTupleMaker()

  - ### Method Detail

    - #### createTuple

          public Tuple createTuple(Schema schema,
                                   Object[] objs)
                            throws StreamBaseException

      Description copied from interface: `TupleMaker`
      create a `Tuple`s from an input object
      Specified by:
        `createTuple` in interface `TupleMaker<Object[]>`
      Specified by:
        `createTuple` in class `AbstractTupleMaker<Object[]>`
      Parameters:
        `schema` - the schema for the tuple
        `objs` - the input data to build it from
      Returns:
        the result tuple
      Throws:
        `StreamBaseException`

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.