![JAR search and dependency download from the Maven repository](/logo.png)
org.simpleflatmapper.jdbc.impl.setter.ConvertDelegateIndexSetter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-jdbc Show documentation
Show all versions of sfm-jdbc Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.simpleflatmapper.jdbc.impl.setter;
import org.simpleflatmapper.converter.Context;
import org.simpleflatmapper.map.setter.ContextualIndexedSetter;
import org.simpleflatmapper.util.ErrorHelper;
import org.simpleflatmapper.converter.ContextualConverter;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class ConvertDelegateIndexSetter implements PreparedStatementIndexSetter {
private final ContextualIndexedSetter setter;
private final ContextualConverter super I, ? extends O> converter;
public ConvertDelegateIndexSetter(ContextualIndexedSetter setter, ContextualConverter super I, ? extends O> converter) {
this.setter = setter;
this.converter = converter;
}
@Override
public void set(PreparedStatement target, I value, int columnIndex, Context context) throws SQLException {
try {
setter.set(target, converter.convert(value, context), columnIndex, context);
} catch (Exception e) {
ErrorHelper.rethrow(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy