You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by df...@apache.org on 2009/11/03 01:24:04 UTC
svn commit: r832220 - in /commons/proper/dbutils/trunk: ./
src/java/org/apache/commons/dbutils/
src/java/org/apache/commons/dbutils/handlers/
src/java/org/apache/commons/dbutils/wrappers/
src/test/org/apache/commons/dbutils/ src/test/org/apache/commons...
Author: dfabulich
Date: Tue Nov 3 00:24:02 2009
New Revision: 832220
URL: http://svn.apache.org/viewvc?rev=832220&view=rev
Log:
Merging in Java5 branch; eliminated compiler warnings
Modified:
commons/proper/dbutils/trunk/ (props changed)
commons/proper/dbutils/trunk/pom.xml
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/BasicRowProcessor.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/BeanProcessor.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ProxyFactory.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryLoader.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryRunner.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ResultSetHandler.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ResultSetIterator.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/RowProcessor.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java (contents, props changed)
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/KeyedHandler.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapHandler.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSet.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryLoaderTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/ResultSetIteratorTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ArrayHandlerTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ArrayListHandlerTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/BeanHandlerTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/BeanListHandlerTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ColumnListHandlerTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/MapHandlerTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/MapListHandlerTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ScalarHandlerTest.java
commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
Propchange: commons/proper/dbutils/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Nov 3 00:24:02 2009
@@ -0,0 +1,2 @@
+/commons/sandbox/dbutils/bugfixing:741987-747450
+/commons/sandbox/dbutils/java5:741988-832184
Modified: commons/proper/dbutils/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/pom.xml?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/pom.xml [utf-8] (original)
+++ commons/proper/dbutils/trunk/pom.xml [utf-8] Tue Nov 3 00:24:02 2009
@@ -179,6 +179,8 @@
</dependencies>
<properties>
+ <maven.compile.source>1.5</maven.compile.source>
+ <maven.compile.target>1.5</maven.compile.target>
<commons.componentid>dbutils</commons.componentid>
<commons.release.version>1.2</commons.release.version>
<commons.rc.version>RC3</commons.rc.version>
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/BasicRowProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/BasicRowProcessor.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/BasicRowProcessor.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/BasicRowProcessor.java Tue Nov 3 00:24:02 2009
@@ -20,7 +20,6 @@
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -107,7 +106,7 @@
* @see org.apache.commons.dbutils.RowProcessor#toBean(java.sql.ResultSet, java.lang.Class)
* @see org.apache.commons.dbutils.BeanProcessor#toBean(java.sql.ResultSet, java.lang.Class)
*/
- public Object toBean(ResultSet rs, Class type) throws SQLException {
+ public <T> T toBean(ResultSet rs, Class<T> type) throws SQLException {
return this.convert.toBean(rs, type);
}
@@ -117,7 +116,7 @@
* @see org.apache.commons.dbutils.RowProcessor#toBeanList(java.sql.ResultSet, java.lang.Class)
* @see org.apache.commons.dbutils.BeanProcessor#toBeanList(java.sql.ResultSet, java.lang.Class)
*/
- public List toBeanList(ResultSet rs, Class type) throws SQLException {
+ public <T> List<T> toBeanList(ResultSet rs, Class<T> type) throws SQLException {
return this.convert.toBeanList(rs, type);
}
@@ -128,8 +127,8 @@
* <code>map.get("col")</code> return the same value.
* @see org.apache.commons.dbutils.RowProcessor#toMap(java.sql.ResultSet)
*/
- public Map toMap(ResultSet rs) throws SQLException {
- Map result = new CaseInsensitiveHashMap();
+ public Map<String, Object> toMap(ResultSet rs) throws SQLException {
+ Map<String, Object> result = new CaseInsensitiveHashMap();
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
@@ -155,9 +154,8 @@
* key.toString().toLowerCase()
* </pre>
*/
- private static class CaseInsensitiveHashMap extends HashMap {
-
- /**
+ private static class CaseInsensitiveHashMap extends HashMap<String, Object> {
+ /**
* The internal mapping from lowercase keys to the real keys.
*
* <p>
@@ -171,18 +169,19 @@
* </ul>
* </p>
*/
- private final Map lowerCaseMap = new HashMap();
+ private final Map<String,String> lowerCaseMap = new HashMap<String,String>();
/**
* Required for serialization support.
*
* @see java.io.Serializable
*/
- private static final long serialVersionUID = 1841673097701957808L;
+ private static final long serialVersionUID = -2848100435296897392L;
/**
* @see java.util.Map#containsKey(java.lang.Object)
*/
+ @Override
public boolean containsKey(Object key) {
Object realKey = lowerCaseMap.get(key.toString().toLowerCase());
return super.containsKey(realKey);
@@ -195,6 +194,7 @@
/**
* @see java.util.Map#get(java.lang.Object)
*/
+ @Override
public Object get(Object key) {
Object realKey = lowerCaseMap.get(key.toString().toLowerCase());
return super.get(realKey);
@@ -203,7 +203,8 @@
/**
* @see java.util.Map#put(java.lang.Object, java.lang.Object)
*/
- public Object put(Object key, Object value) {
+ @Override
+ public Object put(String key, Object value) {
/*
* In order to keep the map and lowerCaseMap synchronized,
* we have to remove the old mapping before putting the
@@ -220,11 +221,10 @@
/**
* @see java.util.Map#putAll(java.util.Map)
*/
- public void putAll(Map m) {
- Iterator iter = m.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry) iter.next();
- Object key = entry.getKey();
+ @Override
+ public void putAll(Map<? extends String,?> m) {
+ for (Map.Entry<? extends String, ?> entry : m.entrySet()) {
+ String key = entry.getKey();
Object value = entry.getValue();
this.put(key, value);
}
@@ -233,6 +233,7 @@
/**
* @see java.util.Map#remove(java.lang.Object)
*/
+ @Override
public Object remove(Object key) {
Object realKey = lowerCaseMap.remove(key.toString().toLowerCase());
return super.remove(realKey);
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/BeanProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/BeanProcessor.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/BeanProcessor.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/BeanProcessor.java Tue Nov 3 00:24:02 2009
@@ -62,7 +62,7 @@
* is returned. These are the same as the defaults that ResultSet get*
* methods return in the event of a NULL column.
*/
- private static final Map primitiveDefaults = new HashMap();
+ private static final Map<Class<?>, Object> primitiveDefaults = new HashMap<Class<?>, Object>();
static {
primitiveDefaults.put(Integer.TYPE, new Integer(0));
@@ -115,7 +115,7 @@
* @throws SQLException if a database access error occurs
* @return the newly created bean
*/
- public Object toBean(ResultSet rs, Class type) throws SQLException {
+ public <T> T toBean(ResultSet rs, Class<T> type) throws SQLException {
PropertyDescriptor[] props = this.propertyDescriptors(type);
@@ -158,8 +158,8 @@
* @throws SQLException if a database access error occurs
* @return the newly created List of beans
*/
- public List toBeanList(ResultSet rs, Class type) throws SQLException {
- List results = new ArrayList();
+ public <T> List<T> toBeanList(ResultSet rs, Class<T> type) throws SQLException {
+ List<T> results = new ArrayList<T>();
if (!rs.next()) {
return results;
@@ -186,11 +186,11 @@
* @return An initialized object.
* @throws SQLException if a database error occurs.
*/
- private Object createBean(ResultSet rs, Class type,
+ private <T> T createBean(ResultSet rs, Class<T> type,
PropertyDescriptor[] props, int[] columnToProperty)
throws SQLException {
- Object bean = this.newInstance(type);
+ T bean = this.newInstance(type);
for (int i = 1; i < columnToProperty.length; i++) {
@@ -199,7 +199,7 @@
}
PropertyDescriptor prop = props[columnToProperty[i]];
- Class propType = prop.getPropertyType();
+ Class<?> propType = prop.getPropertyType();
Object value = this.processColumn(rs, i, propType);
@@ -230,7 +230,7 @@
return;
}
- Class[] params = setter.getParameterTypes();
+ Class<?>[] params = setter.getParameterTypes();
try {
// convert types for some popular ones
if (value != null) {
@@ -280,7 +280,7 @@
* @param type The setter's parameter type.
* @return boolean True if the value is compatible.
*/
- private boolean isCompatibleType(Object value, Class type) {
+ private boolean isCompatibleType(Object value, Class<?> type) {
// Do object check first, then primitives
if (value == null || type.isInstance(value)) {
return true;
@@ -329,7 +329,7 @@
* @return A newly created object of the Class.
* @throws SQLException if creation failed.
*/
- protected Object newInstance(Class c) throws SQLException {
+ protected <T> T newInstance(Class<T> c) throws SQLException {
try {
return c.newInstance();
@@ -350,7 +350,7 @@
* @return A PropertyDescriptor[] describing the Class.
* @throws SQLException if introspection failed.
*/
- private PropertyDescriptor[] propertyDescriptors(Class c)
+ private PropertyDescriptor[] propertyDescriptors(Class<?> c)
throws SQLException {
// Introspector caches BeanInfo classes for better performance
BeanInfo beanInfo = null;
@@ -430,9 +430,13 @@
* index after optional type processing or <code>null</code> if the column
* value was SQL NULL.
*/
- protected Object processColumn(ResultSet rs, int index, Class propType)
+ protected Object processColumn(ResultSet rs, int index, Class<?> propType)
throws SQLException {
-
+
+ if ( !propType.isPrimitive() && rs.getObject(index) == null ) {
+ return null;
+ }
+
if ( !propType.isPrimitive() && rs.getObject(index) == null ) {
return null;
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ProxyFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ProxyFactory.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ProxyFactory.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ProxyFactory.java Tue Nov 3 00:24:02 2009
@@ -37,52 +37,11 @@
public class ProxyFactory {
/**
- * Class[] for CallableStatement interface.
- */
- private static final Class[] callableStatementClass =
- new Class[] { CallableStatement.class };
-
- /**
- * Class[] for Connection interface.
- */
- private static final Class[] connectionClass =
- new Class[] { Connection.class };
-
- /**
- * Class[] for Driver interface.
- */
- private static final Class[] driverClass = new Class[] { Driver.class };
-
- /**
* The Singleton instance of this class.
*/
private static final ProxyFactory instance = new ProxyFactory();
/**
- * Class[] for ResultSetMetaData interface.
- */
- private static final Class[] metaClass =
- new Class[] { ResultSetMetaData.class };
-
- /**
- * Class[] for PreparedStatement interface.
- */
- private static final Class[] preparedStatementClass =
- new Class[] { PreparedStatement.class };
-
- /**
- * Class[] for ResultSet interface.
- */
- private static final Class[] resultSetClass =
- new Class[] { ResultSet.class };
-
- /**
- * Class[] for Statement interface.
- */
- private static final Class[] statementClass =
- new Class[] { Statement.class };
-
- /**
* Returns the Singleton instance of this class.
*
* @return singleton instance
@@ -98,16 +57,24 @@
super();
}
+ /** Convenience method to generate a single-interface proxy using the handler's classloader
+ *
+ * @param <T> The type of object to proxy
+ * @param type The type of object to proxy
+ * @param handler The handler that intercepts/overrides method calls.
+ * @return proxied object
+ */
+ public <T> T newProxyInstance(Class<T> type, InvocationHandler handler) {
+ return type.cast(Proxy.newProxyInstance(handler.getClass().getClassLoader(), new Class<?>[] {type}, handler));
+ }
+
/**
* Creates a new proxy <code>CallableStatement</code> object.
* @param handler The handler that intercepts/overrides method calls.
* @return proxied CallableStatement
*/
public CallableStatement createCallableStatement(InvocationHandler handler) {
- return (CallableStatement) Proxy.newProxyInstance(
- handler.getClass().getClassLoader(),
- callableStatementClass,
- handler);
+ return newProxyInstance(CallableStatement.class, handler);
}
/**
@@ -116,10 +83,7 @@
* @return proxied Connection
*/
public Connection createConnection(InvocationHandler handler) {
- return (Connection) Proxy.newProxyInstance(
- handler.getClass().getClassLoader(),
- connectionClass,
- handler);
+ return newProxyInstance(Connection.class, handler);
}
/**
@@ -128,10 +92,7 @@
* @return proxied Driver
*/
public Driver createDriver(InvocationHandler handler) {
- return (Driver) Proxy.newProxyInstance(
- handler.getClass().getClassLoader(),
- driverClass,
- handler);
+ return newProxyInstance(Driver.class, handler);
}
/**
@@ -140,10 +101,7 @@
* @return proxied PreparedStatement
*/
public PreparedStatement createPreparedStatement(InvocationHandler handler) {
- return (PreparedStatement) Proxy.newProxyInstance(
- handler.getClass().getClassLoader(),
- preparedStatementClass,
- handler);
+ return newProxyInstance(PreparedStatement.class, handler);
}
/**
@@ -152,10 +110,7 @@
* @return proxied ResultSet
*/
public ResultSet createResultSet(InvocationHandler handler) {
- return (ResultSet) Proxy.newProxyInstance(
- handler.getClass().getClassLoader(),
- resultSetClass,
- handler);
+ return newProxyInstance(ResultSet.class, handler);
}
/**
@@ -164,10 +119,7 @@
* @return proxied ResultSetMetaData
*/
public ResultSetMetaData createResultSetMetaData(InvocationHandler handler) {
- return (ResultSetMetaData) Proxy.newProxyInstance(
- handler.getClass().getClassLoader(),
- metaClass,
- handler);
+ return newProxyInstance(ResultSetMetaData.class, handler);
}
/**
@@ -176,10 +128,7 @@
* @return proxied Statement
*/
public Statement createStatement(InvocationHandler handler) {
- return (Statement) Proxy.newProxyInstance(
- handler.getClass().getClassLoader(),
- statementClass,
- handler);
+ return newProxyInstance(Statement.class, handler);
}
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryLoader.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryLoader.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryLoader.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryLoader.java Tue Nov 3 00:24:02 2009
@@ -46,7 +46,7 @@
/**
* Maps query set names to Maps of their queries.
*/
- private final Map queries = new HashMap();
+ private final Map<String,Map<String,String>> queries = new HashMap<String, Map<String,String>>();
/**
* QueryLoader constructor.
@@ -69,9 +69,9 @@
* the given path.
* @return Map of query names to SQL values
*/
- public synchronized Map load(String path) throws IOException {
+ public synchronized Map<String,String> load(String path) throws IOException {
- Map queryMap = (Map) this.queries.get(path);
+ Map<String,String> queryMap = (Map<String,String>) this.queries.get(path);
if (queryMap == null) {
queryMap = this.loadQueries(path);
@@ -91,7 +91,8 @@
* @since DbUtils 1.1
* @return Map of query names to SQL values
*/
- protected Map loadQueries(String path) throws IOException {
+ @SuppressWarnings("unchecked")
+ protected Map<String,String> loadQueries(String path) throws IOException {
InputStream in = getClass().getResourceAsStream(path);
if (in == null) {
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryRunner.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryRunner.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryRunner.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/QueryRunner.java Tue Nov 3 00:24:02 2009
@@ -125,7 +125,7 @@
rows = stmt.executeBatch();
} catch (SQLException e) {
- this.rethrow(e, sql, params);
+ this.rethrow(e, sql, (Object[])params);
} finally {
close(stmt);
}
@@ -164,7 +164,7 @@
* value to pass in.
* @throws SQLException if a database access error occurs
*/
- public void fillStatement(PreparedStatement stmt, Object[] params)
+ public void fillStatement(PreparedStatement stmt, Object... params)
throws SQLException {
if (params == null) {
@@ -251,7 +251,7 @@
* if a database access error occurs
*/
public void fillStatementWithBean(PreparedStatement stmt, Object bean,
- String[] propertyNames) throws SQLException {
+ String... propertyNames) throws SQLException {
PropertyDescriptor[] descriptors;
try {
descriptors = Introspector.getBeanInfo(bean.getClass())
@@ -344,10 +344,10 @@
* @param rsh The handler that converts the results into an object.
* @return The object returned by the handler.
* @throws SQLException if a database access error occurs
- * @deprecated Use {@link #query(Connection,String,ResultSetHandler,Object[])} instead
+ * @deprecated Use {@link #query(Connection,String,ResultSetHandler<T>,Object...)} instead
*/
- public Object query(Connection conn, String sql, Object param,
- ResultSetHandler rsh) throws SQLException {
+ public <T> T query(Connection conn, String sql, Object param,
+ ResultSetHandler<T> rsh) throws SQLException {
return this.query(conn, sql, rsh, new Object[] { param });
}
@@ -362,13 +362,12 @@
* @param rsh The handler that converts the results into an object.
* @return The object returned by the handler.
* @throws SQLException if a database access error occurs
- * @deprecated Use {@link #query(Connection,String,ResultSetHandler,Object[])} instead
+ * @deprecated Use {@link #query(Connection,String,ResultSetHandler<T>,Object...)} instead
*/
- public Object query(Connection conn, String sql, Object[] params,
- ResultSetHandler rsh) throws SQLException {
+ public <T> T query(Connection conn, String sql, Object[] params,
+ ResultSetHandler<T> rsh) throws SQLException {
return query(conn, sql, rsh, params);
}
-
/**
* Execute an SQL SELECT query with replacement parameters. The
* caller is responsible for closing the connection.
@@ -380,12 +379,12 @@
* @return The object returned by the handler.
* @throws SQLException if a database access error occurs
*/
- public Object query(Connection conn, String sql, ResultSetHandler rsh,
- Object[] params) throws SQLException {
+ public <T> T query(Connection conn, String sql, ResultSetHandler<T> rsh,
+ Object... params) throws SQLException {
PreparedStatement stmt = null;
ResultSet rs = null;
- Object result = null;
+ T result = null;
try {
stmt = this.prepareStatement(conn, sql);
@@ -417,7 +416,7 @@
* @return The object returned by the handler.
* @throws SQLException if a database access error occurs
*/
- public Object query(Connection conn, String sql, ResultSetHandler rsh)
+ public <T> T query(Connection conn, String sql, ResultSetHandler<T> rsh)
throws SQLException {
return this.query(conn, sql, rsh, (Object[]) null);
@@ -435,9 +434,9 @@
*
* @return An object generated by the handler.
* @throws SQLException if a database access error occurs
- * @deprecated Use {@link #query(String,ResultSetHandler,Object[])} instead
+ * @deprecated Use {@link #query(String, ResultSetHandler, Object...)}
*/
- public Object query(String sql, Object param, ResultSetHandler rsh)
+ public <T> T query(String sql, Object param, ResultSetHandler<T> rsh)
throws SQLException {
return this.query(sql, rsh, new Object[] { param });
@@ -457,9 +456,9 @@
*
* @return An object generated by the handler.
* @throws SQLException if a database access error occurs
- * @deprecated Use {@link #query(String,ResultSetHandler,Object[])} instead
+ * @deprecated Use {@link #query(String, ResultSetHandler, Object...)}
*/
- public Object query(String sql, Object[] params, ResultSetHandler rsh)
+ public <T> T query(String sql, Object[] params, ResultSetHandler<T> rsh)
throws SQLException {
return query(sql, rsh, params);
}
@@ -477,7 +476,7 @@
* @return An object generated by the handler.
* @throws SQLException if a database access error occurs
*/
- public Object query(String sql, ResultSetHandler rsh, Object[] params)
+ public <T> T query(String sql, ResultSetHandler<T> rsh, Object... params)
throws SQLException {
Connection conn = this.prepareConnection();
@@ -501,7 +500,7 @@
* @return An object generated by the handler.
* @throws SQLException if a database access error occurs
*/
- public Object query(String sql, ResultSetHandler rsh) throws SQLException {
+ public <T> T query(String sql, ResultSetHandler<T> rsh) throws SQLException {
return this.query(sql, rsh, (Object[]) null);
}
@@ -518,7 +517,7 @@
*
* @throws SQLException if a database access error occurs
*/
- protected void rethrow(SQLException cause, String sql, Object[] params)
+ protected void rethrow(SQLException cause, String sql, Object... params)
throws SQLException {
String causeMessage = cause.getMessage();
@@ -582,7 +581,7 @@
* @return The number of rows updated.
* @throws SQLException if a database access error occurs
*/
- public int update(Connection conn, String sql, Object[] params)
+ public int update(Connection conn, String sql, Object... params)
throws SQLException {
PreparedStatement stmt = null;
@@ -646,7 +645,7 @@
* @throws SQLException if a database access error occurs
* @return The number of rows updated.
*/
- public int update(String sql, Object[] params) throws SQLException {
+ public int update(String sql, Object... params) throws SQLException {
Connection conn = this.prepareConnection();
try {
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ResultSetHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ResultSetHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ResultSetHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ResultSetHandler.java Tue Nov 3 00:24:02 2009
@@ -22,7 +22,7 @@
/**
* Implementations of this interface convert ResultSets into other objects.
*/
-public interface ResultSetHandler {
+public interface ResultSetHandler<T> {
/**
* Turn the <code>ResultSet</code> into an Object.
@@ -36,6 +36,6 @@
*
* @throws SQLException if a database access error occurs
*/
- public Object handle(ResultSet rs) throws SQLException;
+ public T handle(ResultSet rs) throws SQLException;
}
\ No newline at end of file
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ResultSetIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ResultSetIterator.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ResultSetIterator.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/ResultSetIterator.java Tue Nov 3 00:24:02 2009
@@ -22,7 +22,7 @@
/**
* <p>
- * Wraps a <code>ResultSet</code> in an <code>Iterator</code>. This is useful
+ * Wraps a <code>ResultSet</code> in an <code>Iterator<Object[]></code>. This is useful
* when you want to present a non-database application layer with domain
* neutral data.
* </p>
@@ -32,7 +32,7 @@
* to be implemented.
* </p>
*/
-public class ResultSetIterator implements Iterator {
+public class ResultSetIterator implements Iterator<Object[]> {
/**
* The wrapped <code>ResultSet</code>.
@@ -49,7 +49,7 @@
* @param rs Wrap this <code>ResultSet</code> in an <code>Iterator</code>.
*/
public ResultSetIterator(ResultSet rs) {
- this(rs , new BasicRowProcessor());
+ this(rs, new BasicRowProcessor());
}
/**
@@ -85,7 +85,7 @@
* @see java.util.Iterator#next()
* @throws RuntimeException if an SQLException occurs.
*/
- public Object next() {
+ public Object[] next() {
try {
rs.next();
return this.convert.toArray(rs);
@@ -118,4 +118,21 @@
throw new RuntimeException(e.getMessage());
}
+ /** Generates an <code>Iterable</code>, suitable for use in for-each loops.
+ *
+ * @param <T> the type of the bean to create
+ * @param rs Wrap this <code>ResultSet</code> in an <code>Iterator</code>.
+ * @param type The type of bean to create
+ * @return an <code>Iterable</code>, suitable for use in for-each loops.
+ */
+ public static Iterable<Object[]> iterable(final ResultSet rs) {
+ return new Iterable<Object[]>() {
+
+ public Iterator<Object[]> iterator() {
+ return new ResultSetIterator(rs);
+ }
+
+ };
+ }
+
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/RowProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/RowProcessor.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/RowProcessor.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/RowProcessor.java Tue Nov 3 00:24:02 2009
@@ -55,7 +55,7 @@
* @throws SQLException if a database access error occurs
* @return the newly created bean
*/
- public Object toBean(ResultSet rs, Class type) throws SQLException;
+ public <T> T toBean(ResultSet rs, Class<T> type) throws SQLException;
/**
* Create a <code>List</code> of JavaBeans from the column values in all
@@ -68,7 +68,7 @@
* @return A <code>List</code> of beans with the given type in the order
* they were returned by the <code>ResultSet</code>.
*/
- public List toBeanList(ResultSet rs, Class type) throws SQLException;
+ public <T> List<T> toBeanList(ResultSet rs, Class<T> type) throws SQLException;
/**
* Create a <code>Map</code> from the column values in one
@@ -81,6 +81,6 @@
* @throws SQLException if a database access error occurs
* @return the newly created Map
*/
- public Map toMap(ResultSet rs) throws SQLException;
+ public Map<String, Object> toMap(ResultSet rs) throws SQLException;
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java Tue Nov 3 00:24:02 2009
@@ -29,7 +29,7 @@
*
* @see org.apache.commons.dbutils.ResultSetHandler
*/
-public abstract class AbstractListHandler implements ResultSetHandler {
+public abstract class AbstractListHandler<T> implements ResultSetHandler<List<T>> {
/**
* Whole <code>ResultSet</code> handler. It produce <code>List</code> as
* result. To convert individual rows into Java objects it uses
@@ -37,8 +37,8 @@
*
* @see #handleRow(ResultSet)
*/
- public Object handle(ResultSet rs) throws SQLException {
- List rows = new ArrayList();
+ public List<T> handle(ResultSet rs) throws SQLException {
+ List<T> rows = new ArrayList<T>();
while (rs.next()) {
rows.add(this.handleRow(rs));
}
@@ -52,5 +52,5 @@
* @return row processing result
* @throws SQLException error occurs
*/
- protected abstract Object handleRow(ResultSet rs) throws SQLException;
+ protected abstract T handleRow(ResultSet rs) throws SQLException;
}
Propchange: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 3 00:24:02 2009
@@ -0,0 +1,2 @@
+/commons/sandbox/dbutils/java5/src/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java:741988-832184
+/jakarta/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java:141655-560656,560658-560659
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java Tue Nov 3 00:24:02 2009
@@ -30,7 +30,7 @@
*
* @see org.apache.commons.dbutils.ResultSetHandler
*/
-public class ArrayHandler implements ResultSetHandler {
+public class ArrayHandler implements ResultSetHandler<Object[]> {
/**
* Singleton processor instance that handlers share to save memory. Notice
@@ -73,7 +73,7 @@
* @throws SQLException if a database access error occurs
* @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
*/
- public Object handle(ResultSet rs) throws SQLException {
+ public Object[] handle(ResultSet rs) throws SQLException {
return rs.next() ? this.convert.toArray(rs) : null;
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java Tue Nov 3 00:24:02 2009
@@ -28,7 +28,7 @@
*
* @see org.apache.commons.dbutils.ResultSetHandler
*/
-public class ArrayListHandler extends AbstractListHandler {
+public class ArrayListHandler extends AbstractListHandler<Object[]> {
/**
* The RowProcessor implementation to use when converting rows
@@ -64,7 +64,7 @@
* @throws SQLException if a database access error occurs
* @see org.apache.commons.dbutils.handlers.AbstractListHandler#handle(ResultSet)
*/
- protected Object handleRow(ResultSet rs) throws SQLException {
+ protected Object[] handleRow(ResultSet rs) throws SQLException {
return this.convert.toArray(rs);
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java Tue Nov 3 00:24:02 2009
@@ -28,12 +28,12 @@
*
* @see org.apache.commons.dbutils.ResultSetHandler
*/
-public class BeanHandler implements ResultSetHandler {
+public class BeanHandler<T> implements ResultSetHandler<T> {
/**
* The Class of beans produced by this handler.
*/
- private final Class type;
+ private final Class<T> type;
/**
* The RowProcessor implementation to use when converting rows
@@ -47,7 +47,7 @@
* @param type The Class that objects returned from <code>handle()</code>
* are created from.
*/
- public BeanHandler(Class type) {
+ public BeanHandler(Class<T> type) {
this(type, ArrayHandler.ROW_PROCESSOR);
}
@@ -59,7 +59,7 @@
* @param convert The <code>RowProcessor</code> implementation
* to use when converting rows into beans.
*/
- public BeanHandler(Class type, RowProcessor convert) {
+ public BeanHandler(Class<T> type, RowProcessor convert) {
this.type = type;
this.convert = convert;
}
@@ -74,7 +74,7 @@
* @throws SQLException if a database access error occurs
* @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
*/
- public Object handle(ResultSet rs) throws SQLException {
+ public T handle(ResultSet rs) throws SQLException {
return rs.next() ? this.convert.toBean(rs, this.type) : null;
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java Tue Nov 3 00:24:02 2009
@@ -18,6 +18,7 @@
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.List;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.RowProcessor;
@@ -29,12 +30,12 @@
*
* @see org.apache.commons.dbutils.ResultSetHandler
*/
-public class BeanListHandler implements ResultSetHandler {
+public class BeanListHandler<T> implements ResultSetHandler<List<T>> {
/**
* The Class of beans produced by this handler.
*/
- private final Class type;
+ private final Class<T> type;
/**
* The RowProcessor implementation to use when converting rows
@@ -48,7 +49,7 @@
* @param type The Class that objects returned from <code>handle()</code>
* are created from.
*/
- public BeanListHandler(Class type) {
+ public BeanListHandler(Class<T> type) {
this(type, ArrayHandler.ROW_PROCESSOR);
}
@@ -60,7 +61,7 @@
* @param convert The <code>RowProcessor</code> implementation
* to use when converting rows into beans.
*/
- public BeanListHandler(Class type, RowProcessor convert) {
+ public BeanListHandler(Class<T> type, RowProcessor convert) {
this.type = type;
this.convert = convert;
}
@@ -76,7 +77,7 @@
* @throws SQLException if a database access error occurs
* @see org.apache.commons.dbutils.RowProcessor#toBeanList(ResultSet, Class)
*/
- public Object handle(ResultSet rs) throws SQLException {
+ public List<T> handle(ResultSet rs) throws SQLException {
return this.convert.toBeanList(rs, type);
}
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java Tue Nov 3 00:24:02 2009
@@ -27,7 +27,7 @@
* @see org.apache.commons.dbutils.ResultSetHandler
* @since DbUtils 1.1
*/
-public class ColumnListHandler extends AbstractListHandler {
+public class ColumnListHandler extends AbstractListHandler<Object> {
/**
* The column number to retrieve.
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/KeyedHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/KeyedHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/KeyedHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/KeyedHandler.java Tue Nov 3 00:24:02 2009
@@ -57,7 +57,7 @@
* @see org.apache.commons.dbutils.ResultSetHandler
* @since DbUtils 1.1
*/
-public class KeyedHandler implements ResultSetHandler {
+public class KeyedHandler implements ResultSetHandler<Map<Object,Map<String,Object>>> {
/**
* The RowProcessor implementation to use when converting rows
@@ -132,8 +132,8 @@
* @throws SQLException if a database access error occurs
* @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
*/
- public Object handle(ResultSet rs) throws SQLException {
- Map result = createMap();
+ public Map<Object,Map<String,Object>> handle(ResultSet rs) throws SQLException {
+ Map<Object,Map<String,Object>> result = createMap();
while (rs.next()) {
result.put(createKey(rs), createRow(rs));
}
@@ -147,8 +147,8 @@
*
* @return Map to store records in
*/
- protected Map createMap() {
- return new HashMap();
+ protected Map<Object,Map<String,Object>> createMap() {
+ return new HashMap<Object,Map<String,Object>>();
}
/**
@@ -175,7 +175,7 @@
* @return Object typed Map containing column names to values
* @throws SQLException if a database access error occurs
*/
- protected Object createRow(ResultSet rs) throws SQLException {
+ protected Map<String,Object> createRow(ResultSet rs) throws SQLException {
return this.convert.toMap(rs);
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapHandler.java Tue Nov 3 00:24:02 2009
@@ -18,6 +18,7 @@
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.Map;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.RowProcessor;
@@ -29,7 +30,7 @@
*
* @see org.apache.commons.dbutils.ResultSetHandler
*/
-public class MapHandler implements ResultSetHandler {
+public class MapHandler implements ResultSetHandler<Map<String,Object>> {
/**
* The RowProcessor implementation to use when converting rows
@@ -67,7 +68,7 @@
*
* @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
*/
- public Object handle(ResultSet rs) throws SQLException {
+ public Map<String,Object> handle(ResultSet rs) throws SQLException {
return rs.next() ? this.convert.toMap(rs) : null;
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java Tue Nov 3 00:24:02 2009
@@ -18,6 +18,7 @@
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.Map;
import org.apache.commons.dbutils.RowProcessor;
@@ -28,7 +29,7 @@
*
* @see org.apache.commons.dbutils.ResultSetHandler
*/
-public class MapListHandler extends AbstractListHandler {
+public class MapListHandler extends AbstractListHandler<Map<String,Object>> {
/**
* The RowProcessor implementation to use when converting rows
@@ -64,7 +65,7 @@
*
* @see org.apache.commons.dbutils.handlers.AbstractListHandler#handle(ResultSet)
*/
- protected Object handleRow(ResultSet rs) throws SQLException {
+ protected Map<String,Object> handleRow(ResultSet rs) throws SQLException {
return this.convert.toMap(rs);
}
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java Tue Nov 3 00:24:02 2009
@@ -27,7 +27,7 @@
*
* @see org.apache.commons.dbutils.ResultSetHandler
*/
-public class ScalarHandler implements ResultSetHandler {
+public class ScalarHandler implements ResultSetHandler<Object> {
/**
* The column number to retrieve.
Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java (original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java Tue Nov 3 00:24:02 2009
@@ -74,7 +74,7 @@
* Maps normal method names (ie. "getBigDecimal") to the corresponding null
* Method object (ie. getNullBigDecimal).
*/
- private static final Map nullMethods = new HashMap();
+ private static final Map<String,Method> nullMethods = new HashMap<String,Method>();
static {
Method[] methods = SqlNullCheckedResultSet.class.getMethods();
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/BasicRowProcessorTest.java Tue Nov 3 00:24:02 2009
@@ -63,14 +63,14 @@
TestBean row = null;
assertTrue(this.rs.next());
- row = (TestBean) processor.toBean(this.rs, TestBean.class);
+ row = processor.toBean(this.rs, TestBean.class);
assertEquals("1", row.getOne());
assertEquals("2", row.getTwo());
assertEquals("3", row.getThree());
assertEquals("not set", row.getDoNotSet());
assertTrue(this.rs.next());
- row = (TestBean) processor.toBean(this.rs, TestBean.class);
+ row = processor.toBean(this.rs, TestBean.class);
assertEquals("4", row.getOne());
assertEquals("5", row.getTwo());
@@ -91,17 +91,17 @@
public void testToBeanList() throws SQLException, ParseException {
- List list = processor.toBeanList(this.rs, TestBean.class);
+ List<TestBean> list = processor.toBeanList(this.rs, TestBean.class);
assertNotNull(list);
assertEquals(ROWS, list.size());
- TestBean b = (TestBean) list.get(0);
+ TestBean b = list.get(0);
assertEquals("1", b.getOne());
assertEquals("2", b.getTwo());
assertEquals("3", b.getThree());
assertEquals("not set", b.getDoNotSet());
- b = (TestBean) list.get(1);
+ b = list.get(1);
assertEquals("4", b.getOne());
assertEquals("5", b.getTwo());
assertEquals("6", b.getThree());
@@ -119,7 +119,7 @@
public void testToMap() throws SQLException {
assertTrue(this.rs.next());
- Map m = processor.toMap(this.rs);
+ Map<String, Object> m = processor.toMap(this.rs);
assertEquals(COLS, m.keySet().size());
assertEquals("1", m.get("one"));
assertEquals("2", m.get("TWO"));
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSet.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSet.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSet.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/MockResultSet.java Tue Nov 3 00:24:02 2009
@@ -24,6 +24,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
/**
* MockResultSet dynamically implements the ResultSet interface.
@@ -47,7 +48,7 @@
private Object[] currentRow = null;
- private Iterator iter = null;
+ private Iterator<Object[]> iter = null;
private ResultSetMetaData metaData = null;
@@ -61,9 +62,12 @@
public MockResultSet(ResultSetMetaData metaData, Object[][] rows) {
super();
this.metaData = metaData;
- this.iter = (rows == null)
- ? Collections.EMPTY_LIST.iterator()
- : Arrays.asList(rows).iterator();
+ if (rows == null) {
+ List<Object[]> empty = Collections.emptyList();
+ this.iter = empty.iterator();
+ } else {
+ this.iter = Arrays.asList(rows).iterator();
+ }
}
/**
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryLoaderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryLoaderTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryLoaderTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryLoaderTest.java Tue Nov 3 00:24:02 2009
@@ -30,13 +30,13 @@
public void testLoad() throws IOException {
try {
QueryLoader loader = QueryLoader.instance();
- Map q = loader.load(QUERIES);
- Map q2 = loader.load(QUERIES);
+ Map<String,String> q = loader.load(QUERIES);
+ Map<String,String> q2 = loader.load(QUERIES);
assertTrue(q == q2); // pointer comparison should return true
assertEquals("SELECT * FROM SomeTable", q.get("test.query"));
loader.unload(QUERIES);
- Map q3 = loader.load(QUERIES);
+ Map<String,String> q3 = loader.load(QUERIES);
assertTrue(q != q3); // pointer comparison should return false
} catch (IllegalArgumentException e) {
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/QueryRunnerTest.java Tue Nov 3 00:24:02 2009
@@ -205,7 +205,7 @@
private class NoOpFillStatement extends QueryRunner {
Object[] params;
- public void fillStatement(PreparedStatement stmt, Object[] params)
+ public void fillStatement(PreparedStatement stmt, Object... params)
throws SQLException {
this.params = params;
}
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/ResultSetIteratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/ResultSetIteratorTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/ResultSetIteratorTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/ResultSetIteratorTest.java Tue Nov 3 00:24:02 2009
@@ -25,7 +25,7 @@
public void testNext() {
- Iterator iter = new ResultSetIterator(this.rs);
+ Iterator<Object[]> iter = new ResultSetIterator(this.rs);
Object[] row = null;
assertTrue(iter.hasNext());
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ArrayHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ArrayHandlerTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ArrayHandlerTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ArrayHandlerTest.java Tue Nov 3 00:24:02 2009
@@ -27,7 +27,7 @@
public class ArrayHandlerTest extends BaseTestCase {
public void testHandle() throws SQLException {
- ResultSetHandler h = new ArrayHandler();
+ ResultSetHandler<Object[]> h = new ArrayHandler();
Object[] results = (Object[]) h.handle(this.rs);
assertNotNull(results);
@@ -38,7 +38,7 @@
}
public void testEmptyResultSetHandle() throws SQLException {
- ResultSetHandler h = new ArrayHandler();
+ ResultSetHandler<Object[]> h = new ArrayHandler();
Object[] results = (Object[]) h.handle(this.emptyResultSet);
assertNull(results);
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ArrayListHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ArrayListHandlerTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ArrayListHandlerTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ArrayListHandlerTest.java Tue Nov 3 00:24:02 2009
@@ -29,13 +29,13 @@
public class ArrayListHandlerTest extends BaseTestCase {
public void testHandle() throws SQLException {
- ResultSetHandler h = new ArrayListHandler();
- List results = (List) h.handle(this.rs);
+ ResultSetHandler<List<Object[]>> h = new ArrayListHandler();
+ List<Object[]> results = h.handle(this.rs);
assertNotNull(results);
assertEquals(ROWS, results.size());
- Iterator iter = results.iterator();
+ Iterator<Object[]> iter = results.iterator();
Object[] row = null;
assertTrue(iter.hasNext());
row = (Object[]) iter.next();
@@ -56,8 +56,8 @@
}
public void testEmptyResultSetHandle() throws SQLException {
- ResultSetHandler h = new ArrayListHandler();
- List results = (List) h.handle(this.emptyResultSet);
+ ResultSetHandler<List<Object[]>> h = new ArrayListHandler();
+ List<Object[]> results = h.handle(this.emptyResultSet);
assertNotNull(results);
assertTrue(results.isEmpty());
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/BeanHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/BeanHandlerTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/BeanHandlerTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/BeanHandlerTest.java Tue Nov 3 00:24:02 2009
@@ -28,8 +28,8 @@
public class BeanHandlerTest extends BaseTestCase {
public void testHandle() throws SQLException {
- ResultSetHandler h = new BeanHandler(TestBean.class);
- TestBean results = (TestBean) h.handle(this.rs);
+ ResultSetHandler<TestBean> h = new BeanHandler<TestBean>(TestBean.class);
+ TestBean results = h.handle(this.rs);
assertNotNull(results);
assertEquals("1", results.getOne());
@@ -39,7 +39,7 @@
}
public void testEmptyResultSetHandle() throws SQLException {
- ResultSetHandler h = new BeanHandler(TestBean.class);
+ ResultSetHandler<TestBean> h = new BeanHandler<TestBean>(TestBean.class);
TestBean results = (TestBean) h.handle(this.emptyResultSet);
assertNull(results);
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/BeanListHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/BeanListHandlerTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/BeanListHandlerTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/BeanListHandlerTest.java Tue Nov 3 00:24:02 2009
@@ -30,13 +30,13 @@
public class BeanListHandlerTest extends BaseTestCase {
public void testHandle() throws SQLException {
- ResultSetHandler h = new BeanListHandler(TestBean.class);
- List results = (List) h.handle(this.rs);
+ ResultSetHandler<List<TestBean>> h = new BeanListHandler<TestBean>(TestBean.class);
+ List<TestBean> results = (List<TestBean>) h.handle(this.rs);
assertNotNull(results);
assertEquals(ROWS, results.size());
- Iterator iter = results.iterator();
+ Iterator<TestBean> iter = results.iterator();
TestBean row = null;
assertTrue(iter.hasNext());
row = (TestBean) iter.next();
@@ -57,8 +57,8 @@
}
public void testEmptyResultSetHandle() throws SQLException {
- ResultSetHandler h = new BeanListHandler(TestBean.class);
- List results = (List) h.handle(this.emptyResultSet);
+ ResultSetHandler<List<TestBean>> h = new BeanListHandler<TestBean>(TestBean.class);
+ List<TestBean> results = h.handle(this.emptyResultSet);
assertNotNull(results);
assertTrue(results.isEmpty());
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ColumnListHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ColumnListHandlerTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ColumnListHandlerTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ColumnListHandlerTest.java Tue Nov 3 00:24:02 2009
@@ -28,9 +28,9 @@
public class ColumnListHandlerTest extends BaseTestCase {
public void testHandle() throws SQLException {
- ResultSetHandler h = new ColumnListHandler();
+ ResultSetHandler<List<Object>> h = new ColumnListHandler();
- List results = (List) h.handle(this.rs);
+ List<Object> results = h.handle(this.rs);
assertNotNull(results);
assertEquals(ROWS, results.size());
@@ -40,8 +40,8 @@
}
public void testColumnIndexHandle() throws SQLException {
- ResultSetHandler h = new ColumnListHandler(2);
- List results = (List) h.handle(this.rs);
+ ResultSetHandler<List<Object>> h = new ColumnListHandler(2);
+ List<Object> results = h.handle(this.rs);
assertNotNull(results);
assertEquals(ROWS, results.size());
@@ -51,8 +51,8 @@
}
public void testColumnNameHandle() throws SQLException {
- ResultSetHandler h = new ColumnListHandler("Three");
- List results = (List) h.handle(this.rs);
+ ResultSetHandler<List<Object>> h = new ColumnListHandler("Three");
+ List<Object> results = h.handle(this.rs);
assertNotNull(results);
assertEquals(ROWS, results.size());
@@ -62,8 +62,8 @@
}
public void testEmptyResultSetHandle() throws SQLException {
- ResultSetHandler h = new ColumnListHandler();
- List results = (List) h.handle(this.emptyResultSet);
+ ResultSetHandler<List<Object>> h = new ColumnListHandler();
+ List<Object> results = h.handle(this.emptyResultSet);
assertNotNull(results);
assertTrue(results.isEmpty());
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/KeyedHandlerTest.java Tue Nov 3 00:24:02 2009
@@ -26,78 +26,78 @@
public class KeyedHandlerTest extends BaseTestCase {
public void testHandle() throws SQLException {
- ResultSetHandler h = new KeyedHandler();
+ ResultSetHandler<Map<Object,Map<String,Object>>> h = new KeyedHandler();
- Map results = (Map) h.handle(this.rs);
+ Map<Object,Map<String,Object>> results = h.handle(this.rs);
assertNotNull(results);
assertEquals(ROWS, results.size());
- Iterator iter = results.keySet().iterator();
- Map row = null;
+ Iterator<Object> iter = results.keySet().iterator();
+ Map<String,Object> row = null;
while (iter.hasNext()) {
Object key = iter.next();
assertNotNull(key);
- row = (Map) results.get(key);
+ row = results.get(key);
assertNotNull(row);
assertEquals(COLS, row.keySet().size());
}
- row = (Map) results.get("1");
+ row = results.get("1");
assertEquals("1", row.get("one"));
assertEquals("2", row.get("TWO"));
assertEquals("3", row.get("Three"));
}
public void testColumnIndexHandle() throws SQLException {
- ResultSetHandler h = new KeyedHandler(2);
- Map results = (Map) h.handle(this.rs);
+ ResultSetHandler<Map<Object,Map<String,Object>>> h = new KeyedHandler(2);
+ Map<Object,Map<String,Object>> results = h.handle(this.rs);
assertNotNull(results);
assertEquals(ROWS, results.size());
- Iterator iter = results.keySet().iterator();
- Map row = null;
+ Iterator<Object> iter = results.keySet().iterator();
+ Map<String,Object> row = null;
while (iter.hasNext()) {
Object key = iter.next();
assertNotNull(key);
- row = (Map) results.get(key);
+ row = results.get(key);
assertNotNull(row);
assertEquals(COLS, row.keySet().size());
}
- row = (Map) results.get("5");
+ row = results.get("5");
assertEquals("4", row.get("one"));
assertEquals("5", row.get("TWO"));
assertEquals("6", row.get("Three"));
}
public void testColumnNameHandle() throws SQLException {
- ResultSetHandler h = new KeyedHandler("three");
- Map results = (Map) h.handle(this.rs);
+ ResultSetHandler<Map<Object,Map<String,Object>>> h = new KeyedHandler("three");
+ Map<Object,Map<String,Object>> results = h.handle(this.rs);
assertNotNull(results);
assertEquals(ROWS, results.size());
- Iterator iter = results.keySet().iterator();
- Map row = null;
+ Iterator<Object> iter = results.keySet().iterator();
+ Map<String,Object> row = null;
while (iter.hasNext()) {
Object key = iter.next();
assertNotNull(key);
- row = (Map) results.get(key);
+ row = results.get(key);
assertNotNull(row);
assertEquals(COLS, row.keySet().size());
}
- row = (Map) results.get("6");
+ row = results.get("6");
assertEquals("4", row.get("one"));
assertEquals("5", row.get("TWO"));
assertEquals("6", row.get("Three"));
}
public void testEmptyResultSetHandle() throws SQLException {
- ResultSetHandler h = new KeyedHandler();
- Map results = (Map) h.handle(this.emptyResultSet);
+ ResultSetHandler<Map<Object,Map<String,Object>>> h = new KeyedHandler();
+ Map<Object,Map<String,Object>> results = h.handle(this.emptyResultSet);
assertNotNull(results);
assertTrue(results.isEmpty());
}
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/MapHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/MapHandlerTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/MapHandlerTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/MapHandlerTest.java Tue Nov 3 00:24:02 2009
@@ -28,8 +28,8 @@
public class MapHandlerTest extends BaseTestCase {
public void testHandle() throws SQLException {
- ResultSetHandler h = new MapHandler();
- Map results = (Map) h.handle(this.rs);
+ ResultSetHandler<Map<String,Object>> h = new MapHandler();
+ Map<String,Object> results = h.handle(this.rs);
assertNotNull(results);
assertEquals(COLS, results.keySet().size());
@@ -39,8 +39,8 @@
}
public void testEmptyResultSetHandle() throws SQLException {
- ResultSetHandler h = new MapHandler();
- Map results = (Map) h.handle(this.emptyResultSet);
+ ResultSetHandler<Map<String,Object>> h = new MapHandler();
+ Map<String,Object> results = h.handle(this.emptyResultSet);
assertNull(results);
}
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/MapListHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/MapListHandlerTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/MapListHandlerTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/MapListHandlerTest.java Tue Nov 3 00:24:02 2009
@@ -30,23 +30,23 @@
public class MapListHandlerTest extends BaseTestCase {
public void testHandle() throws SQLException {
- ResultSetHandler h = new MapListHandler();
- List results = (List) h.handle(this.rs);
+ ResultSetHandler<List<Map<String,Object>>> h = new MapListHandler();
+ List<Map<String,Object>> results = h.handle(this.rs);
assertNotNull(results);
assertEquals(ROWS, results.size());
- Iterator iter = results.iterator();
- Map row = null;
+ Iterator<Map<String,Object>> iter = results.iterator();
+ Map<String,Object> row = null;
assertTrue(iter.hasNext());
- row = (Map) iter.next();
+ row = iter.next();
assertEquals(COLS, row.keySet().size());
assertEquals("1", row.get("one"));
assertEquals("2", row.get("TWO"));
assertEquals("3", row.get("Three"));
assertTrue(iter.hasNext());
- row = (Map) iter.next();
+ row = iter.next();
assertEquals(COLS, row.keySet().size());
assertEquals("4", row.get("one"));
@@ -57,8 +57,8 @@
}
public void testEmptyResultSetHandle() throws SQLException {
- ResultSetHandler h = new MapListHandler();
- List results = (List) h.handle(this.emptyResultSet);
+ ResultSetHandler<List<Map<String,Object>>> h = new MapListHandler();
+ List<Map<String,Object>> results = h.handle(this.emptyResultSet);
assertNotNull(results);
assertTrue(results.isEmpty());
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ScalarHandlerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ScalarHandlerTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ScalarHandlerTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/handlers/ScalarHandlerTest.java Tue Nov 3 00:24:02 2009
@@ -24,28 +24,28 @@
public class ScalarHandlerTest extends BaseTestCase {
public void testHandle() throws SQLException {
- ResultSetHandler h = new ScalarHandler();
+ ResultSetHandler<Object> h = new ScalarHandler();
Object results = h.handle(this.rs);
assertNotNull(results);
assertEquals("1", results);
}
public void testColumnIndexHandle() throws SQLException {
- ResultSetHandler h = new ScalarHandler(2);
+ ResultSetHandler<Object> h = new ScalarHandler(2);
Object results = h.handle(this.rs);
assertNotNull(results);
assertEquals("2", results);
}
public void testColumnNameHandle() throws SQLException {
- ResultSetHandler h = new ScalarHandler("THree");
+ ResultSetHandler<Object> h = new ScalarHandler("THree");
Object results = h.handle(this.rs);
assertNotNull(results);
assertEquals("3", results);
}
public void testEmptyResultSetHandle() throws SQLException {
- ResultSetHandler h = new ScalarHandler();
+ ResultSetHandler<Object> h = new ScalarHandler();
Object results = h.handle(this.emptyResultSet);
assertNull(results);
}
Modified: commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java?rev=832220&r1=832219&r2=832220&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java (original)
+++ commons/proper/dbutils/trunk/src/test/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java Tue Nov 3 00:24:02 2009
@@ -330,9 +330,9 @@
assertTrue(rs.wasNull());
assertNull(rs.getObject("column"));
assertTrue(rs.wasNull());
- assertNull(rs.getObject(1, (Map) null));
+ assertNull(rs.getObject(1, (Map<String, Class<?>>) null));
assertTrue(rs.wasNull());
- assertNull(rs.getObject("column", (Map) null));
+ assertNull(rs.getObject("column", (Map<String, Class<?>>) null));
assertTrue(rs.wasNull());
// Set what gets returned to something other than the default
Object o = new Object();
@@ -341,10 +341,10 @@
assertEquals(o, rs.getObject(1));
assertNotNull(rs.getObject("column"));
assertEquals(o, rs.getObject("column"));
- assertNotNull(rs.getObject(1, (Map) null));
- assertEquals(o, rs.getObject(1, (Map) null));
- assertNotNull(rs.getObject("column", (Map) null));
- assertEquals(o, rs.getObject("column", (Map) null));
+ assertNotNull(rs.getObject(1, (Map<String, Class<?>>) null));
+ assertEquals(o, rs.getObject(1, (Map<String, Class<?>>) null));
+ assertNotNull(rs.getObject("column", (Map<String, Class<?>>) null));
+ assertEquals(o, rs.getObject("column", (Map<String, Class<?>>) null));
}
@@ -715,10 +715,10 @@
assertEquals(o, rs.getObject(1));
assertNotNull(rs.getObject("column"));
assertEquals(o, rs.getObject("column"));
- assertNotNull(rs.getObject(1, (Map) null));
- assertEquals(o, rs.getObject(1, (Map) null));
- assertNotNull(rs.getObject("column", (Map) null));
- assertEquals(o, rs.getObject("column", (Map) null));
+ assertNotNull(rs.getObject(1, (Map<String, Class<?>>) null));
+ assertEquals(o, rs.getObject(1, (Map<String, Class<?>>) null));
+ assertNotNull(rs.getObject("column", (Map<String, Class<?>>) null));
+ assertEquals(o, rs.getObject("column", (Map<String, Class<?>>) null));
}
/**
@@ -808,7 +808,7 @@
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
- Class returnType = method.getReturnType();
+ Class<?> returnType = method.getReturnType();
if (method.getName().equals("wasNull")) {
return Boolean.TRUE;
@@ -960,7 +960,7 @@
}
- public Object getObject(Map map) throws SQLException {
+ public Object getObject(Map<String,Class<?>> map) throws SQLException {
return null;
}