View Javadoc
1 package net.sf.voruta; 2 3 import java.util.*; 4 5 /*** transforms row to bean 6 * @author baliuka 7 */ 8 public class BeanHandler implements ResultSetHandler{ 9 10 /*** Creates a new instance of BeanHandler 11 * 12 */ 13 public BeanHandler() { 14 15 } 16 17 public Object handle(DbResultSet rs,Class type, Object[] params) throws Exception { 18 Object bean; 19 if(rs.next()){ 20 bean = type.newInstance(); 21 DbUtils.resultSetToBean(rs, bean); 22 if(rs.next()){ 23 throw new DbException("too many results"); 24 } 25 return bean; 26 27 } 28 throw new DbException("no results"); 29 30 } 31 32 33 }

This page was automatically generated by Maven