Make sure that somewhere in your code (a
class that you know is working already) you have a var of type
org.ifm.model.PhoneNumber, not just the RemoteClass declaration. Or there’s
a compiler argument called include-classes I think that you could use to make
sure it gets included, you’d need to check the docs for that.
From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Valy Sivec
Sent: Sunday, April 23, 2006 7:46
AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Flex2B2:
JAVA to AS object serialization issue
Matt,
I have [RemoteClass(alias="org.ifm.model.PhoneNumber")] in
the AS class. Am I missing something?.
Thanks,
Valy
Matt Chotin
<[EMAIL PROTECTED]> wrote:
Do you have a typed reference to your AS
class so that it gets linked in?
From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Valy Sivec
Sent: Friday, April 21, 2006 11:59
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex2B2:
JAVA to AS object serialization issue
I ran into something I woudn't expect to be a problem. Here is the
story.
Have a simple data object in Java that is passed to the Flash player
via remote object call. I see in the log that the object type is what I expect
to have but when I trace the object value via Alert message I get Object.
I believe is something wrong but can't figure out what... Below is the
Java class, the AS2 calss and also the message from the log. Am I missing
something?
import java.io.Serializable;
import java.util.Date;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
public class PhoneNumber implements Serializable {
private long phnuId;
private String phnuPt1Code;
private String phnuPhoneNumber;
private String phnuExtension;
private String phnuIsSource;
private Date phnuCreateTs;
private Date phnuUpdateTs;
private Long phnuIndiId;
public PhoneNumber() {
}
public long getPhnuId() {
return this.phnuId;
}
public void setPhnuId(long phnuId) {
this.phnuId = phnuId;
}
public String getPhnuPt1Code() {
return this.phnuPt1Code;
}
public void setPhnuPt1Code(String phnuPt1Code) {
this.phnuPt1Code = phnuPt1Code;
}
public String getPhnuPhoneNumber() {
return this.phnuPhoneNumber;
}
public void setPhnuPhoneNumber(String
phnuPhoneNumber) {
this.phnuPhoneNumber =
phnuPhoneNumber;
}
public String getPhnuExtension() {
return this.phnuExtension;
}
public void setPhnuExtension(String phnuExtension) {
this.phnuExtension = phnuExtension;
}
public Date getPhnuCreateTs() {
return this.phnuCreateTs;
}
public void setPhnuCreateTs(Date phnuCreateTs) {
this.phnuCreateTs = phnuCreateTs;
}
public Date getPhnuUpdateTs() {
return this.phnuUpdateTs;
}
public void setPhnuUpdateTs(Date phnuUpdateTs) {
this.phnuUpdateTs = phnuUpdateTs;
}
public String getPhnuIsSource() {
return this.phnuIsSource;
}
public void setPhnuIsSource(String phnuIsSource) {
this.phnuIsSource = phnuIsSource;
}
public String toString() {
return new ToStringBuilder(this)
.append("phnuId", getPhnuId())
.toString();
}
public Long getPhnuIndiId() {
return phnuIndiId;
}
public void setPhnuIndiId(Long phnuIndiId) {
this.phnuIndiId = phnuIndiId;
}
public boolean equals(Object other) {
if ( !(other instanceof PhoneNumber)
) return false;
PhoneNumber castOther =
(PhoneNumber) other;
return new EqualsBuilder()
.append(this.getPhnuId(), castOther.getPhnuId())
.isEquals();
}
public int hashCode() {
return new HashCodeBuilder()
.append(getPhnuId())
.toHashCode();
}
}
AS3 class
package org.ifm.model
{
[Bindable]
[RemoteClass(alias="org.ifm.model.PhoneNumber")]
public class PhoneNumber {
public function TlcPhoneNumber(){}
public var phnuId : Number;
public var phnuPt1Code : String;
public var phnuPhoneNumber : String;
public var phnuExtension : String;
public var phnuIsSource : String;
public var phnuCreateTs : Date;
public var phnuUpdateTs : Date;
public var phnuIndiId : Number;
public
function toString() : String
{
var msg : String =
"[***PHONE_NUMBER***PHNU_PHONE_NUMBER" + phnuPhoneNumber +
"]";
return msg;
}
}
}
[Flex] Adapter 'java-object' called
'org.ifm.business.AppFacade.findIndividualById([4339083])'
[Flex] Result: '[EMAIL PROTECTED]'
[Flex] Serializing AMF/HTTP response
Version: 3
(Message #0 targetURI=/5/onResult, responseURI=)
(Typed Object #0
'flex.messaging.messages.AcknowledgeMessage')
destination = null
headers = (Object #1)
correlationId = "7C792757-AD11-2E1C-844EFFFFFFFF7E9F"
messageId =
"39378036-8C0B-5897-38C2-CBDA80793946"
timeToLive = 0.0
timestamp = 1.145644502348E12
clientId =
"39377FC3-CD0A-7DC0-F431-E58CC6883B8C"
body = (Typed Object #2 'org.ifm.model.TlcPhoneNumber')
phnuCreateTs = null
phnuIsSource = "WEB"
phnuUpdateTs = null
phnuPhoneNumber =
"1231231234"
phnuIndiId = null
phnuPt1Code = null
phnuExtension = null
phnuId = 0.0
When display it:
Alert.show("Phone:"+ event.result, "Alert Box",Alert.OK);
it shows
Object, and I would expect to see something like that:
"[***PHONE_NUMBER***PHNU_PHONE_NUMBER" + phnuPhoneNumber +
"]";
I don't see
this hapening for other java objects I have.
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great
rates starting at 1¢/min.
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|
- RE: [flexcoders] Flex2B2: JAVA to AS object serialization is... Matt Chotin
-