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 buildTuple
s from Java objects. Accepts the same objects asTuple.setField(com.streambase.sb.Schema.Field, Object)
.Note that when passing
Tuple
s as value objects to anEnqueuer
orDequeuer
, 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 ObjectArrayTupleMaker
MAKER
StaticObjectArrayTupleMaker
instance suitable as argument toEnqueuer
andExpecter
methods that need aTupleMaker
-
Constructor Summary
Constructors Constructor Description ObjectArrayTupleMaker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tuple
createTuple(Schema schema, Object[] objs)
create aTuple
s from an input object-
Methods inherited from class com.streambase.sb.unittest.AbstractTupleMaker
createTuples, createTuples
-
-
-
-
Field Detail
-
MAKER
public static final ObjectArrayTupleMaker MAKER
StaticObjectArrayTupleMaker
instance suitable as argument toEnqueuer
andExpecter
methods 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:TupleMaker
create aTuple
s from an input object- Specified by:
createTuple
in interfaceTupleMaker<Object[]>
- Specified by:
createTuple
in 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
-
-