1 21 package net.mlw.vlh.adapter.jdbc.dynclass; 22 23 import java.sql.ResultSet ; 24 import java.sql.SQLException ; 25 import java.util.ArrayList ; 26 import java.util.List ; 27 import java.util.Map ; 28 29 import net.mlw.vlh.ValueListInfo; 30 import net.mlw.vlh.adapter.jdbc.AbstractDynaJdbcAdapter; 31 import net.mlw.vlh.adapter.jdbc.util.ResultSetMapGenerator; 32 33 import org.apache.commons.logging.Log; 34 import org.apache.commons.logging.LogFactory; 35 36 import dynclass.BeanCreator; 37 38 45 public class DefaultDynclassAdapter extends AbstractDynaJdbcAdapter 46 { 47 48 private static final Log LOGGER = LogFactory.getLog(DefaultDynclassAdapter.class); 49 50 public List processResultSet(String name, ResultSet result, int numberPerPage, ValueListInfo info) throws SQLException 51 { 52 List list = new ArrayList (); 53 54 ResultSetMapGenerator bg = new ResultSetMapGenerator(result, isUseName(), isLowerCase()); 55 for (int i = 0; result.next() && i < numberPerPage; i++) 56 { 57 try 58 { 59 Map properties = bg.generateMap(); 60 list.add(BeanCreator.createBeanFromMap(properties)); 61 } 62 catch (Exception e) 63 { 64 LOGGER.error(e); 65 } 66 } 67 return list; 68 } 69 } | Popular Tags |