You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ws...@apache.org on 2011/11/26 19:28:16 UTC
svn commit: r1206534 - in
/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers:
BeanMapHandler.java ColumnListHandler.java KeyedHandler.java
ScalarHandler.java
Author: wspeirs
Date: Sat Nov 26 18:28:15 2011
New Revision: 1206534
URL: http://svn.apache.org/viewvc?rev=1206534&view=rev
Log:
- Updated documentation for CCE
Modified:
commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/BeanMapHandler.java
commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/KeyedHandler.java
commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/BeanMapHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/BeanMapHandler.java?rev=1206534&r1=1206533&r2=1206534&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/BeanMapHandler.java (original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/BeanMapHandler.java Sat Nov 26 18:28:15 2011
@@ -155,7 +155,21 @@ public class BeanMapHandler<K, V> extend
this.columnName = columnName;
}
- @SuppressWarnings("unchecked") // cast exception will immediately be thrown and warn the developer
+ /**
+ * This factory method is called by <code>handle()</code> to retrieve the
+ * key value from the current <code>ResultSet</code> row.
+ * @param rs ResultSet to create a key from
+ *
+ * @return K from the configured key column name/index
+ *
+ * @throws SQLException if a database access error occurs
+ * @throws ClassCastException if the class datatype does not match the column type
+ *
+ * @see org.apache.commons.dbutils.handlers.AbstractKeyedHandler#createKey(ResultSet)
+ */
+ // We assume that the user has picked the correct type to match the column
+ // so getObject will return the appropriate type and the cast will succeed.
+ @SuppressWarnings("unchecked")
@Override
protected K createKey(ResultSet rs) throws SQLException {
return (columnName == null) ?
Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java?rev=1206534&r1=1206533&r2=1206534&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java (original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java Sat Nov 26 18:28:15 2011
@@ -87,10 +87,13 @@ public class ColumnListHandler<T> extend
* @return <code>Object</code>, never <code>null</code>.
*
* @throws SQLException if a database access error occurs
+ * @throws ClassCastException if the class datatype does not match the column type
*
* @see org.apache.commons.dbutils.handlers.AbstractListHandler#handle(ResultSet)
*/
- @SuppressWarnings("unchecked") // cast exception will immediately be thrown and warn the developer
+ // We assume that the user has picked the correct type to match the column
+ // so getObject will return the appropriate type and the cast will succeed.
+ @SuppressWarnings("unchecked")
@Override
protected T handleRow(ResultSet rs) throws SQLException {
if (this.columnName == null) {
Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/KeyedHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/KeyedHandler.java?rev=1206534&r1=1206533&r2=1206534&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/KeyedHandler.java (original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/KeyedHandler.java Sat Nov 26 18:28:15 2011
@@ -129,9 +129,13 @@ public class KeyedHandler<K> extends Abs
* configured key column name or index.
* @param rs ResultSet to create a key from
* @return Object from the configured key column name/index
+ *
* @throws SQLException if a database access error occurs
+ * @throws ClassCastException if the class datatype does not match the column type
*/
- @SuppressWarnings("unchecked") // cast exception will immediately be thrown and warn the developer
+ // We assume that the user has picked the correct type to match the column
+ // so getObject will return the appropriate type and the cast will succeed.
+ @SuppressWarnings("unchecked")
@Override
protected K createKey(ResultSet rs) throws SQLException {
return (columnName == null) ?
Modified: commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/ScalarHandler.java?rev=1206534&r1=1206533&r2=1206534&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/ScalarHandler.java (original)
+++ commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/handlers/ScalarHandler.java Sat Nov 26 18:28:15 2011
@@ -89,10 +89,13 @@ public class ScalarHandler<T> implements
* the <code>ResultSet</code>.
*
* @throws SQLException if a database access error occurs
+ * @throws ClassCastException if the class datatype does not match the column type
*
* @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
*/
- @SuppressWarnings("unchecked") // cast exception will immediately be thrown and warn the developer
+ // We assume that the user has picked the correct type to match the column
+ // so getObject will return the appropriate type and the cast will succeed.
+ @SuppressWarnings("unchecked")
public T handle(ResultSet rs) throws SQLException {
if (rs.next()) {