as3-vanilla icon indicating copy to clipboard operation
as3-vanilla copied to clipboard

Support for mapping enums from ex. Java

Open natami opened this issue 11 years ago • 0 comments

Currently i'm using the tool to map from Java to As3.

In my project i employ a number of Java Enums.

The as3 counterpart would look the following: public class Locale extends Enum {

public static var DA:Locale = new Locale("DA");
public static var EN:Locale = new Locale("EN");

function Locale(enumName:String) {
    super(enumName);
}

public static function valueOf(enumName:String):Locale {
    return Locale(DA.constantOf(enumName));
}

override protected function getConstants():Array {
    return [DA, EN];
}

}

Currently there seems to be no support for this type of "fake" enums in the As3Vanilla project. This could be a great benefit for json->as3 developers to ensuring real enum support, in favor of the old "string" based types.

natami avatar Dec 02 '13 14:12 natami