use of org.simpleflatmapper.datastax.DatastaxColumnKey in project SimpleFlatMapper by arnaudroger.
the class SettableDataSetterFactoryTest method newPM.
@SuppressWarnings("unchecked")
private <T, P> PropertyMapping<?, ?, DatastaxColumnKey, ? extends ColumnDefinition<DatastaxColumnKey, ?>> newPM(Type clazz, DataType datatype, Object... properties) {
PropertyMeta<T, P> propertyMeta = mock(PropertyMeta.class);
when(propertyMeta.getPropertyType()).thenReturn(clazz);
return new PropertyMapping<T, P, DatastaxColumnKey, FieldMapperColumnDefinition<DatastaxColumnKey>>(propertyMeta, new DatastaxColumnKey("col", index++, datatype), FieldMapperColumnDefinition.<DatastaxColumnKey>of(properties));
}
use of org.simpleflatmapper.datastax.DatastaxColumnKey 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.DatastaxColumnKey in project SimpleFlatMapper by arnaudroger.
the class TupleValueSettableDataSetter method newTupleMapper.
public static <T extends Tuple2<?, ?>> Mapper<T, SettableByIndexData> newTupleMapper(Type target, TupleType tt, MapperConfig<DatastaxColumnKey, FieldMapperColumnDefinition<DatastaxColumnKey>> config, ReflectionService reflectionService) {
SettableDataMapperBuilder<T> builder = newFieldMapperBuilder(config, reflectionService, target);
List<DataType> componentTypes = tt.getComponentTypes();
for (int i = 0; i < componentTypes.size(); i++) {
builder.addColumn(new DatastaxColumnKey("elt" + i, i, componentTypes.get(i)));
}
return builder.mapper();
}
use of org.simpleflatmapper.datastax.DatastaxColumnKey in project SimpleFlatMapper by arnaudroger.
the class UDTObjectSettableDataSetter method newUDTMapper.
public static <T> Mapper<T, SettableByIndexData> newUDTMapper(Type target, UserType tt, MapperConfig<DatastaxColumnKey, FieldMapperColumnDefinition<DatastaxColumnKey>> config, ReflectionService reflectionService) {
SettableDataMapperBuilder<T> builder = newFieldMapperBuilder(config, reflectionService, target);
Iterator<UserType.Field> iterator = tt.iterator();
int i = 0;
while (iterator.hasNext()) {
UserType.Field f = iterator.next();
builder.addColumn(new DatastaxColumnKey(f.getName(), i, f.getType()));
i++;
}
return builder.mapper();
}
use of org.simpleflatmapper.datastax.DatastaxColumnKey in project SimpleFlatMapper by arnaudroger.
the class DatastaxUDTGetter method newUDTMapper.
public static <P> Mapper<GettableByIndexData, P> newUDTMapper(Type target, UserType tt, DatastaxMapperFactory factory) {
ConstantSourceMapperBuilder<GettableByIndexData, P, DatastaxColumnKey> builder = newFieldMapperBuilder(factory, target);
Iterator<UserType.Field> iterator = tt.iterator();
int i = 0;
while (iterator.hasNext()) {
UserType.Field f = iterator.next();
FieldMapperColumnDefinition<DatastaxColumnKey> identity = FieldMapperColumnDefinition.identity();
builder.addMapping(new DatastaxColumnKey(f.getName(), i, f.getType()), identity);
i++;
}
return builder.mapper();
}
Aggregations