Enhancement Request filed:
https://bugs.adobe.com/jira/browse/BLZ-17

Vijay

--- In flexcoders@yahoogroups.com, James Ward <[EMAIL PROTECTED]> wrote:
>
> Hi Vijay,
> 
> Only mapping Strings to Enums is supported.  Can you file an enhancement
> request?  http://bugs.adobe.com/flex
> 
> Let the list know the bug number so those interested can go vote for it.
> 
> -James
> 
> 
> On Wed, 2007-12-19 at 19:05 -0800, moonusamy wrote:
> > Unfortunately that doesn't work for me. I have an AS class
> > corresponding to every Java class including enums. I want to be able
> > to pass an instance of the AS class as the arg and have it translate
> > to the appropriate Enum. 
> > 
> > So basically here's what I want to do:
> > on the Java side:
> > public enum Color {RED, GREEN}
> > A method on a Java class Bar as follows:
> > public void foo(Color c);
> > 
> > on the AS side:
> > [RemoteClass(alias="Color")]
> > public class ASColor implements IExternalizable
> > {
> > private var _value:String;
> > 
> > public function ASColor(val:String=null):void {
> > this._value = val;
> > }
> > 
> > public function get value():String {
> > return this._value;
> > }
> > 
> > public static const RED:String = "RED";
> > public static const RED:String = "GREEN"; 
> > 
> > public function readExternal(input:IDataInput):void {
> > this._value = input.readUTF();
> > }
> > 
> > public function writeExternal(output:IDataOutput):void {
> > output.writeUTF(this._value);
> > }
> > }
> > 
> > var c:ASColor = new ASColor(ASColor.RED);
> > invoke foo(c) thru RemoteObject
> > 
> > Note: The enum implementation on the AS side is weak but that is just
> > a limitation of AS3 not having an equivalent of readResolve(). 
> > 
> > --- In flexcoders@yahoogroups.com, "Peter Farland" <pfarland@>
> > wrote:
> > >
> > > If you have an Enum argument in a Java method, you need to send it a
> > > String. During method invocation, BlazeDS will use
> > > Enum.valueOf(desiredClass, yourStringValue) to create an enum on
> > your
> > > behalf.
> > > 
> > > 
> > > -----Original Message-----
> > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
> > On
> > > Behalf Of moonusamy
> > > Sent: Wednesday, December 19, 2007 3:45 PM
> > > To: flexcoders@yahoogroups.com
> > > Subject: [flexcoders] BlazeDS and Java 5 Enum Support - works only
> > one
> > > way?
> > > 
> > > 
> > > If I have a Java method that returns an Enum, it seems to be
> > serialized
> > > ok as a String, but if I have a Java method that takes an Enum
> > argument,
> > > I get the same error I used to get before with LCDS 2.5.1:
> > > 
> > > faultDetail = "Types cannot be instantiated without a public, no
> > > arguments constructor."
> > > 
> > > Java 5 Enums don't have public no-arg constructors.
> > > 
> > > Unless I am missing something, Enum support in BlazeDS works only
> > one
> > > way. Anyone hit this?
> > > 
> > > Vijay
> > > 
> > > 
> > > 
> > > 
> > > --
> > > Flexcoders Mailing List
> > > FAQ:
> > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > > Search Archives:
> > > http://www.mail-archive.com/flexcoders%40yahoogroups.com
> > > Yahoo! Groups Links
> > >
> > 
> > 
> > 
> > 
> >
>


Reply via email to