From 35ca102d640509fcf788ff162e4900e1935fcdaf Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Thu, 9 Dec 2010 00:08:09 +0000 Subject: [PATCH] Oh yeah, that too git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6346 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/tools/ActionScriptUtils.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/threerings/presents/tools/ActionScriptUtils.java b/src/main/java/com/threerings/presents/tools/ActionScriptUtils.java index 37aee252a..ee8a522a8 100644 --- a/src/main/java/com/threerings/presents/tools/ActionScriptUtils.java +++ b/src/main/java/com/threerings/presents/tools/ActionScriptUtils.java @@ -55,6 +55,13 @@ public class ActionScriptUtils return Iterables.getLast(DOT_SPLITTER.split(full)); } + protected static String toSimpleName (Class type) + { + String name = type.getName().substring(type.getName().lastIndexOf(".") + 1); + // inner classes are not supported by ActionScript so we _ + return name.replaceAll("\\$", "_"); + } + public static String toReadObject (Class type) { if (type.equals(String.class)) { @@ -63,12 +70,10 @@ public class ActionScriptUtils } else if (type.equals(Integer.class) || type.equals(Short.class) || type.equals(Byte.class)) { - String name = ActionScriptSource.toSimpleName(type.getName()); - return "readField(" + name + ").value"; + return "readField(" + toSimpleName(type) + ").value"; } else if (type.equals(Long.class)) { - String name = ActionScriptSource.toSimpleName(type.getName()); - return "readField(" + name + ")"; + return "readField(" + toSimpleName(type) + ")"; } else if (type.equals(Boolean.TYPE)) { return "readBoolean()";