3 Replies Latest reply on Nov 28, 2006 10:00 AM by rmarp

    Java -> AS mapping for arrays

      I've got a basic Java -> AS mapping working where my server-side Java "Customer" class is serialized down to my client-side AS "Customer" object via my use of the RemoteClass attribute. But when my Java object returns a Customer[] or a List, the items inside the collection revert back to just "Object"'s instead of "Customer"'s. Any idea why?

      I'm using RemoteObject.
        • 1. Re: Java -> AS mapping for arrays
          Bill Sahlas
          the RemoteClass and the AS Object must be identical and have an exact property match. Any deviation will cause the processor to revert back to Object instead of the Customer class due to inconsistancies that are there
          • 2. Re: Java -> AS mapping for arrays
            rmarp Level 1
            Yeah they are identical and it serializes perfectly when I return a Customer. But when I return a Customer[] (array), i just get Object's, not Customer's on the AS side.

            Is there a certain type of array/collection I need to use or something?
            • 3. Re: Java -> AS mapping for arrays
              rmarp Level 1
              Doh! Ok I solved my own problem. This might be a gotcha for others. Originally, I had code like this in the result handler for my remoteobject:
              var cust:Customer = Customer(event.result);

              But when I was testing returning an array of Customer objects, I changed my code to this just to see what was coming back:

              When I did this, I removed any references to my Customer class so it did not get compiled. Once I added in a dummy reference to my Customer class, all worked well again.