Search code examples
javaactionscript-3apache-flexvectorblazeds

Is there a direct mapping of Flex' Vector to any Java type in Blazeds?


In our Flex application we have an ActionScript3 class containing a property like this:

public var listOfThings:Vector.<Thing>;

And, in the corresponding Java class:

public Vector<Thing> listOfThings;

But we don't seem to be able to map that directly using BlazeDS (AMF3). We get this run-time error (sorry it's in Spanish):

TypeError: Error #1034: Error de conversión forzada: no se puede convertir
mx.collections::ArrayCollection@aa87ac1 en __AS3__.vec.Vector.<my.domain::Thing>.

Is there definitely no way to map Vector types between Java and AS3? I can't find a single example (but I do find a couple of low-level AMF3 attempts at [de]marshalling) therefore I take there isn't a way?


Solution

  • There is no such mapping.
    You have 2 options which will preserve the marshalling of the vector content:

    1. Convert your vector to an array
    2. Convert your vector to a flex collection