use of com.boundary.tuple.TupleSchema in project SimpleFlatMapper by arnaudroger.
the class FastTupleTest method setUp.
@Before
public void setUp() throws Exception {
TupleSchema schema = TupleSchema.builder().addField("fieldA", Long.TYPE).addField("fieldB", Integer.TYPE).addField("fieldC", Short.TYPE).heapMemory().build();
tuple = schema.createTuple();
}
use of com.boundary.tuple.TupleSchema in project SimpleFlatMapper by arnaudroger.
the class FastTupleTest method setUp.
@Before
public void setUp() throws Exception {
TupleSchema schema = TupleSchema.builder().addField("fieldA", Long.TYPE).addField("fieldB", Integer.TYPE).addField("fieldC", Short.TYPE).heapMemory().build();
tuple = schema.createTuple();
}
use of com.boundary.tuple.TupleSchema in project SimpleFlatMapper by arnaudroger.
the class FastTupleTest method testMetaDataOnFastTupleDirectMemory.
@Test
public void testMetaDataOnFastTupleDirectMemory() throws Exception {
final TupleSchema tupleSchema = TupleSchema.builder().addField("fieldA", Long.TYPE).addField("fieldB", Integer.TYPE).addField("fieldC", Short.TYPE).directMemory().build();
final FastTuple tuple = tupleSchema.createTuple();
// creates a new tuple allocated on the JVM heap
@SuppressWarnings("unchecked") ClassMeta<FastTuple> cm = ReflectionService.newInstance().getClassMeta((Class<FastTuple>) tuple.getClass());
final PropertyFinder<FastTuple> propertyFinder = cm.newPropertyFinder(ConstantPredicate.<PropertyMeta<?, ?>>truePredicate());
final PropertyMeta<FastTuple, Long> fieldA = propertyFinder.findProperty(new DefaultPropertyNameMatcher("fieldA", 0, true, true), new Object[0]);
final PropertyMeta<FastTuple, Integer> fieldB = propertyFinder.findProperty(new DefaultPropertyNameMatcher("fieldB", 0, true, true), new Object[0]);
final PropertyMeta<FastTuple, Short> fieldC = propertyFinder.findProperty(new DefaultPropertyNameMatcher("fieldC", 0, true, true), new Object[0]);
final PropertyMeta<FastTuple, ?> fieldD = propertyFinder.findProperty(new DefaultPropertyNameMatcher("fieldD", 0, true, true), new Object[0]);
assertNotNull(fieldA);
assertNotNull(fieldB);
assertNotNull(fieldC);
assertNull(fieldD);
fieldA.getSetter().set(tuple, 6l);
assertEquals(6l, fieldA.getGetter().get(tuple).longValue());
fieldB.getSetter().set(tuple, 7);
assertEquals(7, fieldB.getGetter().get(tuple).intValue());
fieldC.getSetter().set(tuple, (short) 3);
assertEquals(3, fieldC.getGetter().get(tuple).shortValue());
}
Aggregations