1 16 package com.ibatis.sqlmap.engine.type; 17 18 import java.sql.CallableStatement ; 19 import java.sql.PreparedStatement ; 20 import java.sql.ResultSet ; 21 import java.sql.SQLException ; 22 23 26 public class ObjectTypeHandler extends BaseTypeHandler implements TypeHandler { 27 28 public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) 29 throws SQLException { 30 ps.setObject(i, parameter); 31 } 32 33 public Object getResult(ResultSet rs, String columnName) 34 throws SQLException { 35 Object object = rs.getObject(columnName); 36 if (rs.wasNull()) { 37 return null; 38 } else { 39 return object; 40 } 41 } 42 43 public Object getResult(ResultSet rs, int columnIndex) 44 throws SQLException { 45 Object object = rs.getObject(columnIndex); 46 if (rs.wasNull()) { 47 return null; 48 } else { 49 return object; 50 } 51 } 52 53 public Object getResult(CallableStatement cs, int columnIndex) 54 throws SQLException { 55 Object object = cs.getObject(columnIndex); 56 if (cs.wasNull()) { 57 return null; 58 } else { 59 return object; 60 } 61 } 62 63 public Object valueOf(String s) { 64 return s; 65 } 66 67 } 68 | Popular Tags |