views:

419

answers:

4

Hi;

I take data from Java to Flex by AMF (BlazeDS)

In java side object has Integer field. So it can be null.

In Flex side object is int. So null values are deserialized as 0.

This is not what I want, I want to see whether it is 0 or null.

Is there wrapper like (Integer in Java) for Flex? Thanks

+1  A: 

As far as I can tell, there is no such wrapper. You can write one that assigns NaN to the internal int if the argument to the constructor is null

Amarghosh
A: 

As Amarghosh answered, there is no such wrapper. As a workaround, we check the int value for -1 which equals an unassigned int value in our domain.

Christophe Herreman
A: 

Amarghosh has the correct answer, but you'll find as you continue through your project that life is so much easier in the amf world when you apply the "everything is a string" rule. Simply a suggestion that might help a lot in the long run.

Best of luck, Jeremy

jeremy.mooer
"everything is string", then httpservice with xml will be cleaner solution. Why would I use AMF if everything is string?
javanes
Even serializing your xml data via amf is about 5x faster (as per our tests) than httpservice calls + xml. while 70% of our users are in the u.s., 30ish% are in germany, brazil, and china. Every major flex project I've been a part of that has at least one architect treats most simple data types, especially dates, as strings. Most languages have the problem that actionscrip has -- where you trace( 8244.094488188976 ) and get a different number in your console. Treating that number as a string guarantees data integrity.
jeremy.mooer
http://stackoverflow.com/questions/2100228/simple-calculation-problem-with-flex
jeremy.mooer
A: 
chris