1 18 19 package org.apache.beehive.controls.system.jdbc; 20 21 import org.apache.beehive.controls.api.ControlException; 22 import org.apache.beehive.controls.api.context.ControlBeanContext; 23 import org.apache.beehive.controls.system.jdbc.JdbcControl.SQL; 24 25 import java.lang.reflect.Method ; 26 import java.sql.ResultSet ; 27 import java.sql.SQLException ; 28 import java.util.Calendar ; 29 30 33 public class DefaultXmlObjectResultSetMapper extends DefaultObjectResultSetMapper { 34 35 44 public Object mapToResultType(ControlBeanContext context, Method m, ResultSet resultSet, Calendar cal) { 45 46 final Class returnType = m.getReturnType(); 47 final boolean isArray = returnType.isArray(); 48 49 try { 50 if (isArray) { 51 final SQL methodSQL = (SQL) context.getMethodPropertySet(m, SQL.class); 52 return arrayFromResultSet(resultSet, methodSQL.arrayMaxLength(), returnType, cal); 53 } else { 54 55 if (!resultSet.next()) { 56 return _tmf.fixNull(m.getReturnType()); 57 } 58 59 return RowMapperFactory.getRowMapper(resultSet, returnType, cal).mapRowToReturnType(); 60 } 61 } catch (SQLException e) { 62 throw new ControlException(e.getMessage(), e); 63 } 64 } 65 } 66 | Popular Tags |