use of org.simpleflatmapper.reflect.InstantiatorFactory in project SimpleFlatMapper by arnaudroger.
the class ConstantSourceMapperBuilder method getConstructorFieldMappersAndInstantiator.
@SuppressWarnings("unchecked")
private InstantiatorAndFieldMappers getConstructorFieldMappersAndInstantiator() throws MapperBuildingException {
InstantiatorFactory instantiatorFactory = reflectionService.getInstantiatorFactory();
try {
ConstructorInjections constructorInjections = constructorInjections();
Map<Parameter, BiFunction<? super S, ? super MappingContext<? super S>, ?>> injections = constructorInjections.parameterGetterMap;
MapperBiInstantiatorFactory mapperBiInstantiatorFactory = new MapperBiInstantiatorFactory(instantiatorFactory);
GetterFactory<? super S, K> getterFactory = fieldMapperAsGetterFactory();
BiInstantiator<S, MappingContext<? super S>, T> instantiator = mapperBiInstantiatorFactory.<S, T, K, FieldMapperColumnDefinition<K>>getBiInstantiator(mapperSource.source(), target, propertyMappingsBuilder, injections, getterFactory, reflectionService.builderIgnoresNullValues());
return new InstantiatorAndFieldMappers(constructorInjections.fieldMappers, instantiator);
} catch (Exception e) {
return ErrorHelper.rethrow(e);
}
}
Aggregations