use of org.simpleflatmapper.datastax.impl.RowGetterFactory in project SimpleFlatMapper by arnaudroger.
the class RowGetterFactoryTest method testIntGetterOnNullValue.
@Test
public void testIntGetterOnNullValue() throws Exception {
when(row.isNull(1)).thenReturn(true);
assertEquals(null, new RowGetterFactory(null).newGetter(Integer.class, columnKey).get(row));
}
use of org.simpleflatmapper.datastax.impl.RowGetterFactory in project SimpleFlatMapper by arnaudroger.
the class RowGetterFactoryTest method testFloatGetterOnNullValue.
@Test
public void testFloatGetterOnNullValue() throws Exception {
when(row.isNull(1)).thenReturn(true);
assertEquals(null, new RowGetterFactory(null).newGetter(Float.class, columnKey).get(row));
}
use of org.simpleflatmapper.datastax.impl.RowGetterFactory in project SimpleFlatMapper by arnaudroger.
the class DataTypeTest method getGetter.
public static <N> Getter<GettableByIndexData, N> getGetter(Class<N> target, DataType dataType) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
RowGetterFactory rowGetterFactory = new RowGetterFactory(null);
DatastaxColumnKey columnKey = new DatastaxColumnKey("col", 1, dataType);
FieldMapperColumnDefinition<DatastaxColumnKey> columnDefinition = FieldMapperColumnDefinition.identity();
return rowGetterFactory.newGetter(target, columnKey, columnDefinition);
}
use of org.simpleflatmapper.datastax.impl.RowGetterFactory in project SimpleFlatMapper by arnaudroger.
the class DatastaxUDTGetter method newFieldMapperBuilder.
public static <P> ConstantSourceMapperBuilder<GettableByIndexData, P, DatastaxColumnKey> newFieldMapperBuilder(DatastaxMapperFactory factory, Type target) {
MapperConfig<DatastaxColumnKey, FieldMapperColumnDefinition<DatastaxColumnKey>> config = factory.mapperConfig();
MapperSourceImpl<GettableByIndexData, DatastaxColumnKey> mapperSource = new MapperSourceImpl<GettableByIndexData, DatastaxColumnKey>(GettableByIndexData.class, new RowGetterFactory(factory));
ClassMeta<P> classMeta = factory.getClassMeta(target);
return new ConstantSourceMapperBuilder<GettableByIndexData, P, DatastaxColumnKey>(mapperSource, classMeta, config, new DatastaxMappingContextFactoryBuilder(), DatastaxMapperBuilder.KEY_FACTORY);
}
use of org.simpleflatmapper.datastax.impl.RowGetterFactory in project SimpleFlatMapper by arnaudroger.
the class RowGetterFactoryTest method testByteGetterOnNullValue.
@Test
public void testByteGetterOnNullValue() throws Exception {
when(row.isNull(1)).thenReturn(true);
assertEquals(null, new RowGetterFactory(null).newGetter(Byte.class, columnKey.datatype(DataType.bigint())).get(row));
}
Aggregations