From 77ebd3353d2adddf3021e6a2b1e99d0d0ee81c54 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Fri, 2 Mar 2007 19:25:56 +0000 Subject: [PATCH] use parseHumanSizes for longs. Allows 'computing terms' for any long. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@513900 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/IntrospectionHelper.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/IntrospectionHelper.java b/src/main/org/apache/tools/ant/IntrospectionHelper.java index 91d71048a..8f4d88c94 100644 --- a/src/main/org/apache/tools/ant/IntrospectionHelper.java +++ b/src/main/org/apache/tools/ant/IntrospectionHelper.java @@ -31,6 +31,7 @@ import java.util.Locale; 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 @@ public final class IntrospectionHelper { } } }; + } 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 {