View Full Version : Java ArrayList to ArrayCollection problem
bhale
07-03-2008, 09:31 PM
I have an action script class that is bound to a java object. WHen I call the remote object I get this AS class in return. The java class has an ArrayList, and my log files state that the ArrayList has data ands a size of 5. But on the flex side, everything in the class is returmned properly but the action script ArrayCollection variable is null. I checked all documentation and it says that java List will map to ArrayCollection. Anyone have any idea why it doesn't come back? I have returned an java object of List<MyObject> to flex side and this works. It's just the embedded variable inside the action script class that doesn't get set.
Sly_cardinal
07-04-2008, 01:22 AM
Can you post some code showing how you are attempting to set the ArrayCollection instance value?
bhale
07-04-2008, 04:52 PM
These are just two classes (or beans) that mirror each other. The java class is built from an XML feed using JIBX. I am passing the object or class back to flex side and the data is there except for the array, which is null. Here is the code, java class first.
package com.sabre.eps.schemas;
import java.util.ArrayList;
public class ProfileListElementType {
protected String numReturned;
protected String haveMore;
public void addProfile(SearchProfileType profile) {
profileList.add(profile);
}
public SearchProfileType getProfile(int index) {
return (SearchProfileType)profileList.get( index );
}
public int sizeProfileList() {
return profileList.size();
}
public String getNumReturned() {
return this.numReturned;
}
public void setNumReturned(String numReturned) {
this.numReturned = numReturned;
}
public String getHaveMore() {
return this.haveMore;
}
public void setHaveMore(String haveMore) {
this.haveMore = haveMore;
}
protected ArrayList profileList = new ArrayList();
}
And now the actionscrtip file
package com.sabre.stn.eps.profile
{
import mx.collections.ArrayCollection;
[Bindable]
[RemoteClass(alias="com.sabre.eps.schemas.ProfileListElementType")]
public class ProfileListElementType extends Object
{
protected var _numReturned:String;
protected var _haveMore:String;
protected var _profileList:ArrayCollection = new ArrayCollection();
public function ProfileListElementType()
{
}
public function set numReturned(value:String):void {
_numReturned = value;
}
public function get numReturned():String {
return _numReturned;
}
public function set haveMore(value:String):void {
_haveMore = value;
}
public function get haveMore():String {
return _haveMore;
}
public function set profileList(value:ArrayCollection):void {
_profileList = value;
}
public function get profileList():ArrayCollection {
return _profileList;
}
public function addProfile(profile:SearchProfileType):void
{
_profileList.addItem(profile);
}
}
}
bhale
07-04-2008, 04:53 PM
I also tried creating a temp object and adding each element to the array in java code, but that didn't work either.
Sly_cardinal
07-04-2008, 04:58 PM
So at the moment the final value of the '_profileList' property is null?
Sly_cardinal
07-04-2008, 04:59 PM
Are you able to debug the result handler for your remote service call - try to see what sort of information is being returned and how it is being mapped to your Actionscript classes?
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.