I am returning an Array of typed objects from Java. Say the typed object
is X so essentially an Array of X objects. The typed object X internally
contains another typed object Y which then contains an ArrayList of
typed Object Z. My first question is do these complex nested objects get
properly serialized on the ActionScript/Flex end properly. Is it
recommended to have such deep nesting while returning these complex
objects from the Java end.

I am able to retrieve attributes of primitive types such as Strings
directly under object X. However I am not sure how to retrieve object Y
and the nested ArrayList of Z objects that Y contains. This is how my
setup is

=====================================================================
[Bindable]
[RemoteClass(alias="abc.def.Y")]
public class Y_DTO
{
     /**
      * A collection of zero or more Z objects
      */
                 [ArrayElementType ("Z_DTO")]
         public var zObj:ArrayCollection;

         public function Z_DTO()
         {
             zObj = new ArrayCollection();

         }
     }
======================================================================

======================================================================
     [Bindable]
     [RemoteClass(alias="abc.def.Z")]
     public class Z_DTO
     {

         /**
            * The name of the column being filtered
            */
         public var columnName:String;
         public function Z_DTO(){
         }
     }
}
======================================================================

======================================================================
     [Bindable]
     [RemoteClass(alias="abc.def.X")]

     public class X_DTO
     {
     public var userName : String;

     /**
       * The list of filters used in the search.
       */
     public var yObj:Y_DTO;
     public function X_DTO()
     {
         yObj = new Y_DTO();

     }
    }
======================================================================

Finally in my MXML file I have this method that tries to read these
objects:

======================================================================
private function getXYZSuccess(event : ResultEvent):void
         {

     var result:Array = (event as ResultEvent).result as Array;
             xyc = new Array();

         if (result)
         {
         for each(var item:Object in result)
         {
                     xyc.push(X_DTO(item));
                      Alert.show("SearchPreferences
:"+this.xyz.userName+"\n"+ this.xyz.yObj.zObj.columnName+"\n"+
                       }
                }

             }
=======================================================================


this.xyz.yObj.zObj.columnName returns null. Can you tell me how I can
access the object Y_DTO and Z_DTO and their respective elements. What am
I missing here?

any suggestions, comments will be warmly appreciated.

regards



Reply via email to