use of org.simpleflatmapper.map.mapper.DefaultPropertyNameMatcherFactory in project SimpleFlatMapper by arnaudroger.
the class AbstractMapperFactoryTest method testDefaultMapperConfig.
@Test
public void testDefaultMapperConfig() {
MapperFactory mapperFactory = new MapperFactory();
MapperConfig<SampleFieldKey, FieldMapperColumnDefinition<SampleFieldKey>> mapperConfig = mapperFactory.mapperConfig();
final ArrayList<Object> properties = new ArrayList<Object>();
mapperConfig.columnDefinitions().forEach(Object.class, new BiConsumer<Predicate<? super SampleFieldKey>, Object>() {
@Override
public void accept(Predicate<? super SampleFieldKey> predicate, Object o) {
properties.add(o);
}
});
assertTrue(properties.isEmpty());
assertFalse(mapperConfig.failOnAsm());
assertEquals(NO_ASM_MAPPER_THRESHOLD, mapperConfig.asmMapperNbFieldsLimit());
assertNull(mapperConfig.fieldMapperErrorHandler());
assertFalse(mapperConfig.hasFieldMapperErrorHandler());
assertTrue(mapperConfig.mapperBuilderErrorHandler() instanceof RethrowMapperBuilderErrorHandler);
assertTrue(mapperConfig.consumerErrorHandler() instanceof RethrowConsumerErrorHandler);
assertEquals(MapperConfig.MAX_METHOD_SIZE, mapperConfig.maxMethodSize());
assertTrue(mapperConfig.propertyNameMatcherFactory() instanceof DefaultPropertyNameMatcherFactory);
assertTrue(mapperFactory.getReflectionService().isAsmActivated());
}
use of org.simpleflatmapper.map.mapper.DefaultPropertyNameMatcherFactory in project SimpleFlatMapper by arnaudroger.
the class SfmResultSetHandlerFactoryBuilder method newFactory.
@Override
public <E> ResultSetHandlerFactory<E> newFactory(Class<E> aClass) {
boolean exactMatch = !isAutoDeriveColumnNames();
DefaultPropertyNameMatcherFactory propertyNameMatcherFactory = DefaultPropertyNameMatcherFactory.DEFAULT.exactMatch(exactMatch).caseSensitive(isCaseSensitive());
Map<String, String> columnMappings = getColumnMappings();
JdbcMapperFactory jdbcMapperFactory = JdbcMapperFactory.newInstance().propertyNameMatcherFactory(propertyNameMatcherFactory);
if (columnMappings != null) {
jdbcMapperFactory.addAliases(columnMappings);
}
DynamicJdbcMapper<E> dynamicJdbcMapper = (DynamicJdbcMapper<E>) jdbcMapperFactory.newMapper(aClass);
return new SfmResultSetHandlerFactory<E>(dynamicJdbcMapper);
}
Aggregations