commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject svn commit: r1819251 - in /commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils: ./ converters/
Date Mon, 25 Dec 2017 17:16:22 GMT
Author: dbrosius
Date: Mon Dec 25 17:16:22 2017
New Revision: 1819251

URL: http://svn.apache.org/viewvc?rev=1819251&view=rev
Log:
better generics handling

Modified:
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/ResultSetDynaClass.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/AbstractArrayConverter.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/BooleanArrayConverter.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/ByteArrayConverter.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/CharacterArrayConverter.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/DoubleArrayConverter.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/FloatArrayConverter.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/IntegerArrayConverter.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/LongArrayConverter.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/ShortArrayConverter.java
    commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/StringArrayConverter.java

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/JDBCDynaClass.java
Mon Dec 25 17:16:22 2017
@@ -25,6 +25,7 @@ import java.sql.SQLException;
 import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -236,7 +237,7 @@ abstract class JDBCDynaClass implements
     protected void introspect(final ResultSet resultSet) throws SQLException {
 
         // Accumulate an ordered list of DynaProperties
-        final ArrayList<DynaProperty> list = new ArrayList<DynaProperty>();
+        final List<DynaProperty> list = new ArrayList<DynaProperty>();
         final ResultSetMetaData metadata = resultSet.getMetaData();
         final int n = metadata.getColumnCount();
         for (int i = 1; i <= n; i++) { // JDBC is one-relative!

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/ResultSetDynaClass.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/ResultSetDynaClass.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/ResultSetDynaClass.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/ResultSetDynaClass.java
Mon Dec 25 17:16:22 2017
@@ -62,7 +62,7 @@ import java.util.Iterator;
  * use the following code to create standalone copies of the information in
  * a result set:</p>
  * <pre>
- *   ArrayList results = new ArrayList(); // To hold copied list
+ *   List results = new ArrayList(); // To hold copied list
  *   ResultSetDynaClass rsdc = ...;
  *   DynaProperty[] properties = rsdc.getDynaProperties();
  *   BasicDynaClass bdc =

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/AbstractArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/AbstractArrayConverter.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/AbstractArrayConverter.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/AbstractArrayConverter.java
Mon Dec 25 17:16:22 2017
@@ -158,7 +158,7 @@ public abstract class AbstractArrayConve
      * @throws NullPointerException if <code>svalue</code>
      *  is <code>null</code>
      */
-    protected List parseElements(String svalue) {
+    protected List<String> parseElements(String svalue) {
 
         // Validate the passed argument
         if (svalue == null) {
@@ -185,7 +185,7 @@ public abstract class AbstractArrayConve
             st.wordChars('-', '-');
 
             // Split comma-delimited tokens into a List
-            final ArrayList list = new ArrayList();
+            final List<String> list = new ArrayList<String>();
             while (true) {
                 final int ttype = st.nextToken();
                 if ((ttype == StreamTokenizer.TT_WORD) ||
@@ -205,12 +205,6 @@ public abstract class AbstractArrayConve
         } catch (final IOException e) {
 
             throw new ConversionException(e);
-
         }
-
-
-
     }
-
-
 }

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/BooleanArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/BooleanArrayConverter.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/BooleanArrayConverter.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/BooleanArrayConverter.java
Mon Dec 25 17:16:22 2017
@@ -224,10 +224,10 @@ public final class BooleanArrayConverter
         // sequence of values; see method AbstractArrayConverter.parseElements
         // for more information.
         try {
-            final List list = parseElements(value.toString());
+            final List<String> list = parseElements(value.toString());
             final boolean[] results = new boolean[list.size()];
             for (int i = 0; i < results.length; i++) {
-                final String stringValue = (String) list.get(i);
+                final String stringValue = list.get(i);
                 final Object result = booleanConverter.convert(Boolean.class, stringValue);
                 results[i] = ((Boolean) result).booleanValue();
             }

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/ByteArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/ByteArrayConverter.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/ByteArrayConverter.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/ByteArrayConverter.java
Mon Dec 25 17:16:22 2017
@@ -127,10 +127,10 @@ public final class ByteArrayConverter ex
         // Parse the input value as a String into elements
         // and convert to the appropriate type
         try {
-            final List list = parseElements(value.toString());
+            final List<String> list = parseElements(value.toString());
             final byte[] results = new byte[list.size()];
             for (int i = 0; i < results.length; i++) {
-                results[i] = Byte.parseByte((String) list.get(i));
+                results[i] = Byte.parseByte(list.get(i));
             }
             return (results);
         } catch (final Exception e) {

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/CharacterArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/CharacterArrayConverter.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/CharacterArrayConverter.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/CharacterArrayConverter.java
Mon Dec 25 17:16:22 2017
@@ -128,10 +128,10 @@ public final class CharacterArrayConvert
         // Parse the input value as a String into elements
         // and convert to the appropriate type
         try {
-            final List list = parseElements(value.toString());
+            final List<String> list = parseElements(value.toString());
             final char[] results = new char[list.size()];
             for (int i = 0; i < results.length; i++) {
-                results[i] = ((String) list.get(i)).charAt(0);
+                results[i] = (list.get(i)).charAt(0);
             }
             return (results);
         } catch (final Exception e) {

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/DoubleArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/DoubleArrayConverter.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/DoubleArrayConverter.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/DoubleArrayConverter.java
Mon Dec 25 17:16:22 2017
@@ -127,10 +127,10 @@ public final class DoubleArrayConverter
         // Parse the input value as a String into elements
         // and convert to the appropriate type
         try {
-            final List list = parseElements(value.toString());
+            final List<String> list = parseElements(value.toString());
             final double[] results = new double[list.size()];
             for (int i = 0; i < results.length; i++) {
-                results[i] = Double.parseDouble((String) list.get(i));
+                results[i] = Double.parseDouble(list.get(i));
             }
             return (results);
         } catch (final Exception e) {

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/FloatArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/FloatArrayConverter.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/FloatArrayConverter.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/FloatArrayConverter.java
Mon Dec 25 17:16:22 2017
@@ -128,10 +128,10 @@ public final class FloatArrayConverter e
         // Parse the input value as a String into elements
         // and convert to the appropriate type
         try {
-            final List list = parseElements(value.toString());
+            final List<String> list = parseElements(value.toString());
             final float[] results = new float[list.size()];
             for (int i = 0; i < results.length; i++) {
-                results[i] = Float.parseFloat((String) list.get(i));
+                results[i] = Float.parseFloat(list.get(i));
             }
             return (results);
         } catch (final Exception e) {

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/IntegerArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/IntegerArrayConverter.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/IntegerArrayConverter.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/IntegerArrayConverter.java
Mon Dec 25 17:16:22 2017
@@ -128,10 +128,10 @@ public final class IntegerArrayConverter
         // Parse the input value as a String into elements
         // and convert to the appropriate type
         try {
-            final List list = parseElements(value.toString());
+            final List<String> list = parseElements(value.toString());
             final int[] results = new int[list.size()];
             for (int i = 0; i < results.length; i++) {
-                results[i] = Integer.parseInt((String) list.get(i));
+                results[i] = Integer.parseInt(list.get(i));
             }
             return (results);
         } catch (final Exception e) {

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/LongArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/LongArrayConverter.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/LongArrayConverter.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/LongArrayConverter.java
Mon Dec 25 17:16:22 2017
@@ -128,10 +128,10 @@ public final class LongArrayConverter ex
         // Parse the input value as a String into elements
         // and convert to the appropriate type
         try {
-            final List list = parseElements(value.toString());
+            final List<String> list = parseElements(value.toString());
             final long[] results = new long[list.size()];
             for (int i = 0; i < results.length; i++) {
-                results[i] = Long.parseLong((String) list.get(i));
+                results[i] = Long.parseLong(list.get(i));
             }
             return (results);
         } catch (final Exception e) {

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/ShortArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/ShortArrayConverter.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/ShortArrayConverter.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/ShortArrayConverter.java
Mon Dec 25 17:16:22 2017
@@ -128,10 +128,10 @@ public final class ShortArrayConverter e
         // Parse the input value as a String into elements
         // and convert to the appropriate type
         try {
-            final List list = parseElements(value.toString());
+            final List<String> list = parseElements(value.toString());
             final short[] results = new short[list.size()];
             for (int i = 0; i < results.length; i++) {
-                results[i] = Short.parseShort((String) list.get(i));
+                results[i] = Short.parseShort(list.get(i));
             }
             return (results);
         } catch (final Exception e) {

Modified: commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/StringArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/StringArrayConverter.java?rev=1819251&r1=1819250&r2=1819251&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/StringArrayConverter.java
(original)
+++ commons/proper/beanutils/trunk/src/main/java/org/apache/commons/beanutils/converters/StringArrayConverter.java
Mon Dec 25 17:16:22 2017
@@ -153,10 +153,10 @@ public final class StringArrayConverter
         // Parse the input value as a String into elements
         // and convert to the appropriate type
         try {
-            final List list = parseElements(value.toString());
+            final List<String> list = parseElements(value.toString());
             final String[] results = new String[list.size()];
             for (int i = 0; i < results.length; i++) {
-                results[i] = (String) list.get(i);
+                results[i] = list.get(i);
             }
             return (results);
         } catch (final Exception e) {



Mime
View raw message