1 Reply Latest reply on Apr 8, 2008 5:48 AM by riesvantwisk

    Array of typed objects back in flex

    riesvantwisk Level 1
      Hey All,

      I am using a function like this to return a list of objects

      public List<Country> getCountries(String market_code) throws Exception {
      return list;

      Using a debugger I can clearly see that list contains a list of Country.

      County is created like this:

      package admin;
      import java.io.Serializable;
      public class Country implements Serializable {
      public static final long serialVersionUID = 103844514947365244L;
      public String country_code="";
      public String country_name="";
      public Country( ) { }
      public Country(String country_code, String country_name) {
      this.country_code = country_code;
      this.country_name = country_name;

      I also have a County.as file that looks like this:
      package admin
      public class Country
      public Country() {}
      public country_code:String;
      public country_name:String;

      No the problem is that each time I get data back from the java backedn I get a list of Objects, not a list of Country objects.

      Did I miss something obvious?
      This was done with Blaze-DS but I get the same list using WebORB.

      Is it possible at all to get a list of Country, or do I need to cast that myself using a for each loop??


        • 1. Re: Array of typed objects back in flex
          riesvantwisk Level 1

          I solved my issue and although I find the solution a bit a work-around I am not sure if there is a other method.

          In my main MXML I simply need to do something liek this

          private var t1:Country = new Country();

          I will not use t1, but it does tell the compiler that the Country object exists and thus will be used in my array back.