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

org.sfm.datastax.impl.JoinDatastaxMapper Maven / Gradle / Ivy

Go to download

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

The newest version!
package org.sfm.datastax.impl;

import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.exceptions.DriverException;
import org.sfm.datastax.DatastaxMapper;
import org.sfm.map.Mapper;
import org.sfm.map.MappingContext;
import org.sfm.map.MappingContextFactory;
import org.sfm.map.RowHandlerErrorHandler;
import org.sfm.map.impl.AbstractEnumarableDelegateMapper;
import org.sfm.map.impl.JoinEnumarable;
import org.sfm.utils.Enumarable;


public final class JoinDatastaxMapper extends AbstractEnumarableDelegateMapper implements DatastaxMapper {

    private final Mapper mapper;
    private final MappingContextFactory mappingContextFactory;

    public JoinDatastaxMapper(Mapper mapper, RowHandlerErrorHandler errorHandler, MappingContextFactory mappingContextFactory) {
        super(errorHandler);
        this.mapper = mapper;
        this.mappingContextFactory = mappingContextFactory;
    }

    @Override
    protected Mapper getMapper(Row row) {
        return mapper;
    }

    @Override
    protected Enumarable newEnumarableOfT(ResultSet rs)  {
        return new JoinEnumarable(mapper, mappingContextFactory.newContext(), new ResultSetEnumarable(rs));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy