org.simpleflatmapper.map.mapper.StaticSetRowMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-map Show documentation
Show all versions of sfm-map Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.simpleflatmapper.map.mapper;
import org.simpleflatmapper.map.Mapper;
import org.simpleflatmapper.map.MappingContext;
import org.simpleflatmapper.map.MappingException;
import org.simpleflatmapper.map.ConsumerErrorHandler;
import org.simpleflatmapper.map.SetRowMapper;
import org.simpleflatmapper.map.context.MappingContextFactory;
import org.simpleflatmapper.map.impl.StaticMapperEnumarable;
import org.simpleflatmapper.util.Enumarable;
import org.simpleflatmapper.util.UnaryFactory;
public class StaticSetRowMapper extends AbstractEnumarableMapper implements SetRowMapper {
private final Mapper mapper;
private final MappingContextFactory super ROW> mappingContextFactory;
private final UnaryFactory> enumarableFactory;
public StaticSetRowMapper(final Mapper mapper,
final ConsumerErrorHandler errorHandler,
final MappingContextFactory super ROW> mappingContextFactory,
UnaryFactory> enumarableFactory) {
super(errorHandler);
this.mapper = mapper;
this.mappingContextFactory = mappingContextFactory;
this.enumarableFactory = enumarableFactory;
}
@Override
public final T map(ROW rs) throws MappingException {
return mapper.map(rs);
}
@Override
public final T map(ROW rs, MappingContext super ROW> context) throws MappingException {
return mapper.map(rs, context);
}
@Override
public final void mapTo(ROW rs, T target, MappingContext super ROW> context) throws Exception {
mapper.mapTo(rs, target, context);
}
@Override
public String toString() {
return "StaticSetRowMapper{" + mapper + '}';
}
@Override
protected final Enumarable newEnumarableOfT(SET source) throws E {
return new StaticMapperEnumarable(mapper, mappingContextFactory.newContext(), enumarableFactory.newInstance(source));
}
protected MappingContextFactory super ROW> getMappingContextFactory() {
return mappingContextFactory;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy