use of org.simpleflatmapper.map.impl.IdentityFieldMapperColumnDefinitionProvider in project SimpleFlatMapper by arnaudroger.
the class ConstantSourceMapperBuilderTest method testMapInnerObjectWithMapper.
@Test
public void testMapInnerObjectWithMapper() throws Exception {
ConstantSourceMapperBuilder<Object, MyObjectWithInner, SampleFieldKey> constantSourceMapperBuilder = new ConstantSourceMapperBuilder<Object, MyObjectWithInner, SampleFieldKey>(mapperSource, classMeta, MapperConfig.config(new IdentityFieldMapperColumnDefinitionProvider<SampleFieldKey>()), new MappingContextFactoryBuilder<Object, SampleFieldKey>(null), SampleFieldKey.KEY_FACTORY);
constantSourceMapperBuilder.addMapping(new SampleFieldKey("prop_date", 0), FieldMapperColumnDefinition.<SampleFieldKey>identity());
Mapper<Object, MyObjectWithInner> mapper = constantSourceMapperBuilder.mapper();
MyObjectWithInner o = mapper.map(null);
assertEquals(DATE, o.prop.date);
assertNull(o.prop.str);
}
use of org.simpleflatmapper.map.impl.IdentityFieldMapperColumnDefinitionProvider in project SimpleFlatMapper by arnaudroger.
the class ConstantSourceMapperBuilderTest method testAnonymousParameterWithDifferentType.
@Test
public void testAnonymousParameterWithDifferentType() throws Exception {
ConstantSourceMapperBuilder<Object, MyObjectWithInner, SampleFieldKey> constantSourceMapperBuilder = new ConstantSourceMapperBuilder<Object, MyObjectWithInner, SampleFieldKey>(mapperSource, classMeta, MapperConfig.config(new IdentityFieldMapperColumnDefinitionProvider<SampleFieldKey>()), new MappingContextFactoryBuilder<Object, SampleFieldKey>(null), SampleFieldKey.KEY_FACTORY);
constantSourceMapperBuilder.addMapping(new SampleFieldKey("prop", 0, Date.class), FieldMapperColumnDefinition.<SampleFieldKey>identity());
Mapper<Object, MyObjectWithInner> mapper = constantSourceMapperBuilder.mapper();
MyObjectWithInner o = mapper.map(null);
assertEquals(DATE, o.prop.date);
assertNull(o.prop.str);
}
Aggregations