org.sfm.datastax.impl.JoinDatastaxMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simpleFlatMapper Show documentation
Show all versions of simpleFlatMapper Show documentation
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 super Row> mappingContextFactory;
public JoinDatastaxMapper(Mapper mapper, RowHandlerErrorHandler errorHandler, MappingContextFactory super Row> 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));
}
}