[flexcoders] Mapping Java Generics to an AS3 Vector through BlazeDS remoting?

2010-02-21 Thread Jochem van Dieten
ISTM the natural match between Java Generics and ActionScript is the
Vector since it allows one to declare a type for the collection
members. And apparently there are some performance gains to be had
when using a Vector instead of an Array:
http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c3a0f5f19124318fc87b-7fff.html

Does anybody have any tips on getting a Vector of objects out of a
BlazeDS remoting call? I know I can convert an ArrayCollection to a
Vector manually, but that does not seem like a terrible attractive
option to me.

Jochem


-- 
Jochem van Dieten
http://jochem.vandieten.net/


Re: [flexcoders] Mapping Java Generics to an AS3 Vector through BlazeDS remoting?

2010-02-21 Thread Roman Protsiuk
You won't be able to get generic element type information during runtime so
what's the point?
The only likely approach I guess is generic serializer/deserializer. And
still I'm not sure whether vector element type information is
serialized/deserialized with vector or is it just a compile time information
unreachable during runtime.

Roman

On Sun, Feb 21, 2010 at 11:37 AM, Jochem van Dieten joch...@gmail.comwrote:



 ISTM the natural match between Java Generics and ActionScript is the
 Vector since it allows one to declare a type for the collection
 members. And apparently there are some performance gains to be had
 when using a Vector instead of an Array:

 http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c3a0f5f19124318fc87b-7fff.html

 Does anybody have any tips on getting a Vector of objects out of a
 BlazeDS remoting call? I know I can convert an ArrayCollection to a
 Vector manually, but that does not seem like a terrible attractive
 option to me.

 Jochem

 --
 Jochem van Dieten
 http://jochem.vandieten.net/
  



Re: [flexcoders] Mapping Java Generics to an AS3 Vector through BlazeDS remoting?

2010-02-21 Thread Jochem van Dieten
On Sun, Feb 21, 2010 at 2:41 PM, Roman Protsiuk wrote:
 You won't be able to get generic element type information during runtime so 
 what's the point?

That is why Remoting can't distinguish between receiving a generified
collection and a regular collection from the Java backend and has to
fall back to casting to an arraycollection. But what if I just happen
to know and want to force it?


 The only likely approach I guess is generic serializer/deserializer.

That was my idea too. It helps that I am (for now) only looking at a
way to do this from Java to ActionScript, but I am still not sure it
is worth the effort. Which is why I am hoping somebody else has
already tried this.

Jochem


-- 
Jochem van Dieten
http://jochem.vandieten.net/