org.simpleflatmapper.map.mapper.TransformSourceMapper 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.ContextualSourceMapper;
import org.simpleflatmapper.map.MappingContext;
import org.simpleflatmapper.map.MappingException;
import org.simpleflatmapper.map.SourceMapper;
import org.simpleflatmapper.util.Function;
public final class TransformSourceMapper implements ContextualSourceMapper {
private final ContextualSourceMapper delegate;
private final Function super I, ? extends O> transformer;
public TransformSourceMapper(ContextualSourceMapper delegate, Function transformer) {
this.delegate = delegate;
this.transformer = transformer;
}
@Override
public O map(ROW source) throws MappingException {
return transformer.apply(delegate.map(source));
}
@Override
public O map(ROW source, MappingContext super ROW> context) throws MappingException {
return transformer.apply(delegate.map(source, context));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy