Various utility classes moved to flash-utils.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5889 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-07-21 20:56:35 +00:00
parent f005c3e3a8
commit 805ef99374
60 changed files with 26 additions and 6824 deletions
+3 -2
View File
@@ -26,6 +26,7 @@ import flash.utils.Dictionary;
import com.threerings.util.ClassUtil;
import com.threerings.util.Enum;
import com.threerings.util.env.Environment;
import com.threerings.io.streamers.ArrayStreamer;
import com.threerings.io.streamers.ByteStreamer;
@@ -75,10 +76,10 @@ public class Streamer
// But: the code is smaller, so that wins
var clazz :Class = ClassUtil.getClassByName(Translations.getFromServer(jname));
if (ClassUtil.isAssignableAs(Enum, clazz)) {
if (Environment.isAssignableAs(Enum, clazz)) {
streamer = new EnumStreamer(clazz, jname);
} else if (ClassUtil.isAssignableAs(Streamable, clazz)) {
} else if (Environment.isAssignableAs(Streamable, clazz)) {
streamer = new Streamer(clazz, jname);
} else {
@@ -22,7 +22,9 @@
package com.threerings.io.streamers {
import com.threerings.util.ClassUtil;
import com.threerings.util.Enum;
import com.threerings.util.Log;
import com.threerings.util.env.Environment;
import com.threerings.io.ArrayMask;
import com.threerings.io.ObjectInputStream;
@@ -50,9 +52,8 @@ public class ArrayStreamer extends Streamer
// form is "[L<class>;"
var baseJClass :String = jname.substring(2, jname.length - 1);
_delegate = Streamer.getStreamerByJavaName(baseJClass);
_elementType = ClassUtil.getClassByName(
Translations.getFromServer(baseJClass));
_isFinal = ClassUtil.isFinal(_elementType);
_elementType = ClassUtil.getClassByName(Translations.getFromServer(baseJClass));
_isFinal = isFinal(_elementType);
} else if (secondChar === "I") {
_elementType = int;
@@ -148,6 +149,23 @@ public class ArrayStreamer extends Streamer
}
}
protected static function isFinal (type :Class) :Boolean
{
if (type === String) {
return true;
}
// all enums are final, even if you forget to make your enum class final, you punk
if (Environment.isAssignableAs(Enum, type)) {
return true;
}
// TODO: there's currently no way to determine final from the class
// I thought examining the prototype might do it, but no dice.
// Fuckers!
return false;
}
/** A streamer for our elements. */
protected var _delegate :Streamer;