ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r513900 - /ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java
Date Fri, 02 Mar 2007 19:25:57 GMT
Author: mbenson
Date: Fri Mar  2 11:25:56 2007
New Revision: 513900

URL: http://svn.apache.org/viewvc?view=rev&rev=513900
Log:
use parseHumanSizes for longs.  Allows 'computing terms' for any long.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java?view=diff&rev=513900&r1=513899&r2=513900
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/IntrospectionHelper.java Fri Mar  2 11:25:56
2007
@@ -31,6 +31,7 @@
 import java.util.Map;
 import org.apache.tools.ant.types.EnumeratedAttribute;
 import org.apache.tools.ant.taskdefs.PreSetDef;
+import org.apache.tools.ant.util.StringUtils;
 
 /**
  * Helper class that collects the methods a task or nested element
@@ -1030,11 +1031,24 @@
                     }
                 }
             };
+        } else if (java.lang.Long.class.equals(reflectedArg)) {
+            return new AttributeSetter(m) {
+                public void set(Project p, Object parent, String value)
+                        throws InvocationTargetException, IllegalAccessException, BuildException
{
+                    long ell;
+                    try {
+                        ell = StringUtils.parseHumanSizes(value);
+                    } catch (Exception e) {
+                        throw new BuildException(e);
+                    }
+                    m.invoke(parent, new Object[] { new Long(ell) });
+                }
+            };
+        } else {
         // worst case. look for a public String constructor and use it
         // also supports new Whatever(Project, String) as for Path or Reference
         // This is used (deliberately) for all primitives/wrappers other than
-        // char and boolean
-        } else {
+        // char, boolean, and long.
             boolean includeProject;
             Constructor c;
             try {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message