вторник, 8 мая 2007 г.

getters & setters

Just in case you didn't know that, you always need to specify get & set methods for Java class if you need it properly deserialized on the Flex part.
For example
Flex:

[RemoteClass (alias="core.company.CompanyRegionDescBean")]
public class CompanyRegionDescBean
{
public var url:String;
public var name:String;
}


Java:

public class CompanyRegionDescBean implements Serializable{

private String url="";
private String name = "";

public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getName() {
return url;
}
public void setName(String url) {
this.name = name;
}

}


Now, if you remove setName - you will always get name as null on Flex side.

You should also make sure that all your variables are named according to Java conventions, for example, they should start with letter in lowercase.
Just try this one..
private String Name = "";

And you are also in trouble.

Комментариев нет: