org.sql2o.DelegatingResultSetHandler Maven / Gradle / Ivy
package org.sql2o;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* User: dimzon
* Date: 4/7/14
* Time: 11:06 PM
*/
public class DelegatingResultSetHandler implements ResultSetHandler {
private volatile ResultSetHandler inner = null;
private final ResultSetHandlerFactory factory;
public DelegatingResultSetHandler(ResultSetHandlerFactory factory) {
this.factory = factory;
}
public E handle(ResultSet resultSet) throws SQLException {
if(inner==null) inner = factory.newResultSetHandler(resultSet.getMetaData());
return inner.handle(resultSet);
}
}