1 Reply Latest reply on Aug 18, 2009 9:06 AM by msakrejda

    How to handle Enum in Action Script




      I am using flex remoting with Blaze DS 3.2 to communicate with Java Server Objects. I am creating equvivalent value objects in AS3 for java server objects.


      I have a java User class which has userType enum. How do i write the equivalent AS value object for the User object?



        • 1. Re: How to handle Enum in Action Script
          msakrejda Level 4

          I believe Blaze DS serializes enums as plain Strings, no? We use Granite DS and its ActionScript VO generation has a fake-enum sort of class. It works reasonably well, but since ActionScript cannot resolve object references on deserialization, you may end up with two instances of a certain enum member, which can lead to unpredictable behavior (since you probably expect only a single instance, and things like new MyEnum('Foo') == new MyEnum('Foo') will evalute to false).



          Maciek Sakrejda

          Truviso, Inc.


          Truviso is hiring: http://www.truviso.com/company-careers.php?i=87