Author: niallp Date: Sun Jan 10 02:28:21 2010 New Revision: 897588 URL: http://svn.apache.org/viewvc?rev=897588&view=rev Log: BEANUTILS-371 Add constructors which have useColumnLabel parameter to ResultSetDynaClass and RowSetDynaClass - thanks to David Tonhofer
Modified: commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/ResultSetDynaClass.java commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/RowSetDynaClass.java commons/proper/beanutils/trunk/xdocs/changes.xml Modified: commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/ResultSetDynaClass.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/ResultSetDynaClass.java?rev=897588&r1=897587&r2=897588&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/ResultSetDynaClass.java (original) +++ commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/ResultSetDynaClass.java Sun Jan 10 02:28:21 2010 @@ -130,11 +130,42 @@ public ResultSetDynaClass(ResultSet resultSet, boolean lowerCase) throws SQLException { + this(resultSet, lowerCase, false); + + } + + + /** + * <p>Construct a new ResultSetDynaClass for the specified + * <code>ResultSet</code>. The property names corresponding + * to the column names in the result set will be lower cased or not, + * depending on the specified <code>lowerCase</code> value.</p> + * + * <p><strong>WARNING</strong> - If you specify <code>false</code> + * for <code>lowerCase</code>, the returned property names will + * exactly match the column names returned by your JDBC driver. + * Because different drivers might return column names in different + * cases, the property names seen by your application will vary + * depending on which JDBC driver you are using.</p> + * + * @param resultSet The result set to be wrapped + * @param lowerCase Should property names be lower cased? + * @param useColumnLabel true if the column label should be used, otherwise false + * + * @exception NullPointerException if <code>resultSet</code> + * is <code>null</code> + * @exception SQLException if the metadata for this result set + * cannot be introspected + */ + public ResultSetDynaClass(ResultSet resultSet, boolean lowerCase, boolean useColumnLabel) + throws SQLException { + if (resultSet == null) { throw new NullPointerException(); } this.resultSet = resultSet; this.lowerCase = lowerCase; + setUseColumnLabel(useColumnLabel); introspect(resultSet); } Modified: commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/RowSetDynaClass.java URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/RowSetDynaClass.java?rev=897588&r1=897587&r2=897588&view=diff ============================================================================== --- commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/RowSetDynaClass.java (original) +++ commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/RowSetDynaClass.java Sun Jan 10 02:28:21 2010 @@ -178,11 +178,70 @@ public RowSetDynaClass(ResultSet resultSet, boolean lowerCase, int limit) throws SQLException { + this(resultSet, lowerCase, limit, false); + + } + + /** + * <p>Construct a new {...@link RowSetDynaClass} for the specified + * <code>ResultSet</code>. The property names corresponding + * to the column names in the result set will be lower cased or not, + * depending on the specified <code>lowerCase</code> value.</p> + * + * <p><strong>WARNING</strong> - If you specify <code>false</code> + * for <code>lowerCase</code>, the returned property names will + * exactly match the column names returned by your JDBC driver. + * Because different drivers might return column names in different + * cases, the property names seen by your application will vary + * depending on which JDBC driver you are using.</p> + * + * @param resultSet The result set to be wrapped + * @param lowerCase Should property names be lower cased? + * @param useColumnLabel true if the column label should be used, otherwise false + * + * @exception NullPointerException if <code>resultSet</code> + * is <code>null</code> + * @exception SQLException if the metadata for this result set + * cannot be introspected + */ + public RowSetDynaClass(ResultSet resultSet, boolean lowerCase, boolean useColumnLabel) + throws SQLException { + this(resultSet, lowerCase, -1, useColumnLabel); + + } + + /** + * <p>Construct a new {...@link RowSetDynaClass} for the specified + * <code>ResultSet</code>. The property names corresponding + * to the column names in the result set will be lower cased or not, + * depending on the specified <code>lowerCase</code> value.</p> + * + * <p><strong>WARNING</strong> - If you specify <code>false</code> + * for <code>lowerCase</code>, the returned property names will + * exactly match the column names returned by your JDBC driver. + * Because different drivers might return column names in different + * cases, the property names seen by your application will vary + * depending on which JDBC driver you are using.</p> + * + * @param resultSet The result set to be wrapped + * @param lowerCase Should property names be lower cased? + * @param limit Maximum limit for the <code>List</code> of {...@link DynaBean} + * @param useColumnLabel true if the column label should be used, otherwise false + * + * @exception NullPointerException if <code>resultSet</code> + * is <code>null</code> + * @exception SQLException if the metadata for this result set + * cannot be introspected + */ + public RowSetDynaClass(ResultSet resultSet, boolean lowerCase, int limit, boolean useColumnLabel) + throws SQLException { + if (resultSet == null) { throw new NullPointerException(); } this.lowerCase = lowerCase; this.limit = limit; + setUseColumnLabel(useColumnLabel); introspect(resultSet); copy(resultSet); Modified: commons/proper/beanutils/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/xdocs/changes.xml?rev=897588&r1=897587&r2=897588&view=diff ============================================================================== --- commons/proper/beanutils/trunk/xdocs/changes.xml (original) +++ commons/proper/beanutils/trunk/xdocs/changes.xml Sun Jan 10 02:28:21 2010 @@ -39,6 +39,12 @@ </properties> <body> + <release version="1.8.3" date="in SVN" description="Bug fix for 1.8.2"> + <action dev="niallp" type="fix" issue="BEANUTILS-371" due-to="David Tonhofer"> + Add constructors which have useColumnLabel parameter to ResultSetDynaClass and RowSetDynaClass. + </action> + </release> + <release version="1.8.2" date="2009-11-13" description="Bug fix for 1.8.1"> <action dev="niallp" type="fix" issue="BEANUTILS-368" due-to="Peter Fassev"> NullPointerException in BeanUtilsBean .setProperty()