Package 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 buildTuples from Java objects. Accepts the same objects asTuple.setField(com.streambase.sb.Schema.Field, Object).Note that when passing
Tuples as value objects to anEnqueuerorDequeuer, you may obtain the stream's schema fromEnqueuer.getSchema()andDequeuer.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 ofcreateTuple(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 Description static ObjectArrayTupleMakerMAKERStaticObjectArrayTupleMakerinstance suitable as argument toEnqueuerandExpectermethods that need aTupleMaker
-
Constructor Summary
Constructors Constructor Description ObjectArrayTupleMaker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TuplecreateTuple(Schema schema, Object[] objs)create aTuples from an input object-
Methods inherited from class com.streambase.sb.unittest.AbstractTupleMaker
createTuples, createTuples
-
-
-
-
Field Detail
-
MAKER
public static final ObjectArrayTupleMaker MAKER
StaticObjectArrayTupleMakerinstance suitable as argument toEnqueuerandExpectermethods that need aTupleMaker- See Also:
class documentation for example usage
-
-
Method Detail
-
createTuple
public Tuple createTuple(Schema schema, Object[] objs) throws StreamBaseException
Description copied from interface:TupleMakercreate aTuples from an input object- Specified by:
createTuplein interfaceTupleMaker<Object[]>- Specified by:
createTuplein classAbstractTupleMaker<Object[]>- Parameters:
schema- the schema for the tupleobjs- the input data to build it from- Returns:
- the result tuple
- Throws:
StreamBaseException- Error creating tuple
-
-