All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.simpleflatmapper.map.mapper.DefaultSetRowMapperBuilder Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 9.0.2
Show newest version
package org.simpleflatmapper.map.mapper;

import org.simpleflatmapper.map.ConsumerErrorHandler;
import org.simpleflatmapper.map.ContextualSourceFieldMapper;
import org.simpleflatmapper.map.FieldKey;
import org.simpleflatmapper.map.MapperConfig;
import org.simpleflatmapper.map.SetRowMapper;
import org.simpleflatmapper.map.context.KeySourceGetter;
import org.simpleflatmapper.map.context.MappingContextFactory;
import org.simpleflatmapper.map.context.MappingContextFactoryBuilder;
import org.simpleflatmapper.reflect.meta.ClassMeta;
import org.simpleflatmapper.util.Enumerable;
import org.simpleflatmapper.util.Function;
import org.simpleflatmapper.util.UnaryFactory;

public class DefaultSetRowMapperBuilder, E extends Exception> 
        extends SetRowMapperBuilderImpl, ROW, SET, T, K, E> {
    /**
     * @param classMeta           the meta for the target class.
     * @param parentBuilder       the parent builder, null if none.
     * @param mapperConfig        the mapperConfig.
     * @param mapperSource        the Mapper source.
     * @param keyFactory
     * @param enumerableFactory
     * @param keySourceGetter
     */
    public DefaultSetRowMapperBuilder(
            ClassMeta classMeta,
            MappingContextFactoryBuilder parentBuilder,
            MapperConfig mapperConfig, MapperSource mapperSource,
            KeyFactory keyFactory, UnaryFactory> enumerableFactory, 
            KeySourceGetter keySourceGetter) {
        super(
                classMeta, 
                parentBuilder, 
                mapperConfig,
                mapperSource, 
                keyFactory, 
                mapperConfig.applyEnumerableFilter(enumerableFactory),
                new DefaultSetRowMapperFactory(), 
                keySourceGetter);
    }


    public static class DefaultSetRowMapperFactory implements SetRowMapperFactory, ROW, SET, T, E> {

        @Override
        public SetRowMapper newJoinMapper(ContextualSourceFieldMapper mapper, ConsumerErrorHandler consumerErrorHandler, MappingContextFactory mappingContextFactory, UnaryFactory> enumerableFactory) {
            return  new JoinMapper(mapper, consumerErrorHandler,mappingContextFactory, enumerableFactory);
        }

        @Override
        public SetRowMapper newUnorderedJoinMapper(ContextualSourceFieldMapper mapper, ConsumerErrorHandler consumerErrorHandler, MappingContextFactory mappingContextFactory, UnaryFactory> enumerableFactory) {
            return  new UnorderedJoinMapper(mapper, consumerErrorHandler,mappingContextFactory, enumerableFactory);
        }

        @Override
        public SetRowMapper newStaticMapper(ContextualSourceFieldMapper mapper, ConsumerErrorHandler consumerErrorHandler, MappingContextFactory mappingContextFactory, UnaryFactory> enumerableFactory) {
            return  new StaticSetRowMapper(mapper, consumerErrorHandler,mappingContextFactory, enumerableFactory);
        }

        @Override
        public  SetRowMapper newTransformer(SetRowMapper setRowMapper, Function transform) {
            return new TransformSetRowMapper(setRowMapper, transform);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy