public class ObjectArrayTupleMaker extends AbstractTupleMaker<Object[]>
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") });
Tuple.setField(com.streambase.sb.Schema.Field, Object)
,
TupleMaker
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 and Description |
---|
ObjectArrayTupleMaker() |
Modifier and Type | Method and Description |
---|---|
Tuple |
createTuple(Schema schema,
Object[] objs)
create a
Tuple s from an input object |
createTuples, createTuples
public static final ObjectArrayTupleMaker MAKER
ObjectArrayTupleMaker
instance suitable as argument to Enqueuer
and Expecter
methods that need a TupleMaker
class documentation for example usage
public Tuple createTuple(Schema schema, Object[] objs) throws StreamBaseException
TupleMaker
Tuple
s from an input objectcreateTuple
in interface TupleMaker<Object[]>
createTuple
in class AbstractTupleMaker<Object[]>
schema
- the schema for the tupleobjs
- the input data to build it fromStreamBaseException