1 18 19 package org.apache.beehive.controls.system.jdbc; 20 21 import org.apache.beehive.controls.api.ControlException; 22 23 import java.sql.ResultSet ; 24 import java.sql.SQLException ; 25 import java.util.Collections ; 26 import java.util.Calendar ; 27 28 31 public final class RowToMapMapper extends RowMapper { 32 33 private final String [] _keys; 34 35 41 RowToMapMapper(ResultSet resultSet, Class returnTypeClass, Calendar cal) { 42 super(resultSet, returnTypeClass, cal); 43 try { 44 _keys = getKeysFromResultSet(); 45 } catch (SQLException e) { 46 throw new ControlException("RowToMapMapper: SQLException: " + e.getMessage(), e); 47 } 48 } 49 50 55 public Object mapRowToReturnType() { 56 try { 57 return Collections.unmodifiableMap(new ResultSetHashMap(_resultSet, _keys)); 58 } catch (SQLException e) { 59 throw new ControlException("Exception while creating ResultSetHashMap.", e); 60 } 61 } 62 } 63 | Popular Tags |