commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r627916 - /commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertyConverter.java
Date Fri, 15 Feb 2008 00:27:12 GMT
Author: ebourg
Date: Thu Feb 14 16:27:11 2008
New Revision: 627916

URL: http://svn.apache.org/viewvc?rev=627916&view=rev
Log:
Minor change in PropertyConverter to use the varargs methods

Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertyConverter.java

Modified: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertyConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertyConverter.java?rev=627916&r1=627915&r2=627916&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertyConverter.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/PropertyConverter.java
Thu Feb 14 16:27:11 2008
@@ -150,7 +150,7 @@
         {
             result = toLocale(value);
         }
-        else if (isEnum(cls))
+        else if (cls.isEnum())
         {
             // This causes an unchecked warning because the concrete Enum class
             // cannot be fully determined.
@@ -410,7 +410,7 @@
             try
             {
                 Constructor<? extends Number> constr = targetClass.getConstructor(CONSTR_ARGS);
-                return (Number) constr.newInstance(new Object[]{str});
+                return (Number) constr.newInstance(str);
             }
             catch (InvocationTargetException itex)
             {
@@ -708,8 +708,8 @@
             // should be optional.
             try
             {
-                Constructor<?> ctor = Class.forName(INTERNET_ADDRESS_CLASSNAME).getConstructor(new
Class[] {String.class});
-                return ctor.newInstance(new Object[] {value});
+                Constructor<?> ctor = Class.forName(INTERNET_ADDRESS_CLASSNAME).getConstructor(String.class);
+                return ctor.newInstance(value);
             }
             catch (Exception e)
             {
@@ -720,14 +720,6 @@
         {
             throw new ConversionException("The value " + value + " can't be converted to
a InternetAddress");
         }
-    }
-
-    /**
-     * Calls Class.isEnum() on Java 5, returns false on older JRE.
-     */
-    static boolean isEnum(Class<?> cls)
-    {
-        return cls.isEnum();
     }
 
     /**



Mime
View raw message