1 61 62 63 package net.mlw.vlh.adapter.jdbc.dynabean.fix; 64 65 66 import java.sql.ResultSet ; 67 import java.sql.SQLException ; 68 import java.util.HashMap ; 69 import java.util.Iterator ; 70 import java.util.Map ; 71 72 import org.apache.commons.beanutils.DynaBean; 73 import org.apache.commons.beanutils.DynaClass; 74 import org.apache.commons.beanutils.DynaProperty; 75 76 77 133 134 public class ResultSetDynaClass extends JDBCDynaClass implements DynaClass { 135 136 137 139 140 152 public ResultSetDynaClass(ResultSet resultSet) throws SQLException { 153 154 this(resultSet, true, false); 155 156 } 157 158 159 181 public ResultSetDynaClass(ResultSet resultSet, boolean lowerCase, boolean useName) 182 throws SQLException { 183 184 if (resultSet == null) { 185 throw new NullPointerException (); 186 } 187 this.resultSet = resultSet; 188 this.lowerCase = lowerCase; 189 this.useName = useName; 190 introspect(resultSet); 191 192 } 193 194 195 197 198 202 protected boolean lowerCase = true; 203 204 205 208 protected DynaProperty properties[] = null; 209 210 211 216 protected Map propertiesMap = new HashMap (); 217 218 219 222 protected ResultSet resultSet = null; 223 224 225 227 228 234 public Iterator iterator() { 235 236 return (new ResultSetIterator(this)); 237 238 } 239 240 241 243 244 247 ResultSet getResultSet() { 248 249 return (this.resultSet); 250 251 } 252 253 254 256 263 protected Class loadClass(String className) throws SQLException { 264 265 try { 266 return getClass().getClassLoader().loadClass(className); 267 } 268 catch (Exception e) { 269 throw new SQLException ("Cannot load column class '" + 270 className + "': " + e); 271 } 272 } 273 } 274 | Popular Tags |