Support converstion of java enum to com.threerings.util.Enum as part of actionscript streamable conversion.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6600 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2011-04-04 21:11:58 +00:00
parent 7120c9c292
commit cae3a3f1b9
3 changed files with 91 additions and 10 deletions
@@ -0,0 +1,47 @@
// GENERATED PREAMBLE START
{{header}}
package {{package}} {
{{#imports}}
import {{this}};
{{/imports}}
// GENERATED PREAMBLE END
// GENERATED CLASSDECL START
public final class {{classname}} extends Enum
{
// GENERATED CLASSDECL END
// GENERATED ENUM START
{{#enumFields}}
public static const {{name}} :{{classname}} = new {{classname}}("{{name}}");
{{/enumFields}}
finishedEnumerating({{classname}});
/**
* Gets the values of the {{classname}} enum.
*/
public static function values () :Array
{
return Enum.values({{classname}});
}
/**
* Gets the {{classname}} instance that corresponds to the specified string.
* If no such value exists, an ArgumentError will be thrown.
*/
public static function valueOf (name :String) :{{classname}}
{
return Enum.valueOf({{classname}}, name) as {{classname}};
}
/** @private */
public function {{classname}} (name :String)
{
super(name);
}
// GENERATED ENUM END
// GENERATED CLASSFINISH START
}
}
// GENERATED CLASSFINISH END