Copy Java's valueOf factory method for primitive wrapper classes.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4217 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-06-24 23:03:07 +00:00
parent 2382fb5cd6
commit 459f12ded5
8 changed files with 28 additions and 3 deletions
@@ -44,7 +44,7 @@ public class SpeakMarshaller extends InvocationMarshaller
// documentation inherited from interface // documentation inherited from interface
public function speak (arg1 :Client, arg2 :String, arg3 :int) :void public function speak (arg1 :Client, arg2 :String, arg3 :int) :void
{ {
sendRequest(arg1, SPEAK, [ arg2, new Byte(arg3) ]); sendRequest(arg1, SPEAK, [ arg2, Byte.valueOf(arg3) ]);
} }
} }
} }
@@ -181,7 +181,7 @@ public class BodyObject extends ClientObject
{ {
var ovalue :int = this.status; var ovalue :int = this.status;
requestAttributeChange( requestAttributeChange(
STATUS, new Byte(value), new Byte(ovalue)); STATUS, Byte.valueOf(value), Byte.valueOf(ovalue));
this.status = value; this.status = value;
} }
@@ -57,7 +57,7 @@ public class LocationMarshaller extends InvocationMarshaller
{ {
var listener3 :LocationMarshaller_MoveMarshaller = new LocationMarshaller_MoveMarshaller(); var listener3 :LocationMarshaller_MoveMarshaller = new LocationMarshaller_MoveMarshaller();
listener3.listener = arg3; listener3.listener = arg3;
sendRequest(arg1, MOVE_TO, [ new Integer(arg2), listener3 ]); sendRequest(arg1, MOVE_TO, [ Integer.valueOf(arg2), listener3 ]);
} }
} }
} }
+5
View File
@@ -8,6 +8,11 @@ public class Byte
{ {
public var value :int; public var value :int;
public static function valueOf (val :int) :Byte
{
return new Byte(val);
}
public function Byte (value :int) public function Byte (value :int)
{ {
this.value = value; this.value = value;
+5
View File
@@ -8,6 +8,11 @@ public class Float
{ {
public var value :Number; public var value :Number;
public static function valueOf (val :Number) :Float
{
return new Float(val);
}
public function Float (value :Number) public function Float (value :Number)
{ {
this.value = value; this.value = value;
+5
View File
@@ -13,6 +13,11 @@ public class Integer
{ {
public var value :int; public var value :int;
public static function valueOf (val :int) :Integer
{
return new Integer(val);
}
public function Integer (value :int) public function Integer (value :int)
{ {
this.value = value; this.value = value;
+5
View File
@@ -9,6 +9,11 @@ public class Long
public var high :int; public var high :int;
public var low :int; public var low :int;
public static function valueOf (low :int, high :int = 0) :Long
{
return new Long(low, high);
}
public function Long (low :int, high :int = 0) public function Long (low :int, high :int = 0)
{ {
this.low = low; this.low = low;
+5
View File
@@ -8,6 +8,11 @@ public class Short
{ {
public var value :int; public var value :int;
public static function valueOf (val :int) :Short
{
return new Short(val);
}
public function Short (value :int) public function Short (value :int)
{ {
this.value = value; this.value = value;