By Victor Rasputnis | Article Rating: |
|
January 9, 2010 04:30 PM EST | Reads: |
2,611 |

I’d like to use this opportunity and invite Flex developers living in Europe to attend our Advanced Flex Master Class in Brussels, Belgium on March 1 and 2, 2010.
This question we get on almost every new client project: “We’re struggling with handling of null values for numeric data types in Flex/Java projects.
Every time there’s an update, we end up replacing the original nulls with zeros when the user didn’t actually change that value.
Have you guys come up with a silver bullet for handling numeric nulls?”
Consider a Java method with a Double parameter. You pass uninitialized ActionScript Number, that is, Number.NaN. What will BlazeDS deserialize (unmarshal)? Double.NaN.
At this point your Java code may use something like (value==Double.NaN)?null:value
, capitalizing on the fact that information about special value of NaN had been delivered from your client code to your server code. Now, let’s assume you change the signature of the Java method to accept Long instead of Double. You pass NaN and you get … 0!
The same happens with marshaling ActionScript object that carries Number.NaN properties: they turn into 0, if, god forbid, their Java counterparties are declared as Long or Integer.
The reason is that while Java has Double.NaN
it does not support either Long.NaN
or Integer.NaN
. Looking at the following snippet of code you can see how differently Double
and Long
variables get treated by Java:
Published January 9, 2010 Reads 2,611
Copyright © 2010 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Victor Rasputnis
Dr. Victor Rasputnis is a Managing Principal of Farata Systems. He's responsible for providing architectural design, implementation management and mentoring to companies migrating to XML Internet technologies. He holds a PhD in computer science from the Moscow Institute of Robotics. You can reach him at [email protected]
- Flash Player Will Be Packaged with Google Chrome
- Today iPad is the Only Whore in Town
- Apple Checkmates Adobe
- Adobe’s Creative Suite 5 Scheduled
- Adobe Introduces Adobe Flash Catalyst CS5
- The Future of Software Development
- Our Flex Book is a Java Bestseller
- Adobe Turns Host
- Focus Washington TechView Discusses Open Government With Adobe Executive
- Jobs to Adobe: ‘Yer Stinkin’ Flash is Over-the-Hill. Get Over It.’
- Apple on Flash: Hey Steve, "C'mon Man"
- How O'Reilly Helped Me To Come Out Of The Closet
- Flash Player Will Be Packaged with Google Chrome
- Today iPad is the Only Whore in Town
- Apple Checkmates Adobe
- Adobe’s Creative Suite 5 Scheduled
- Adobe Advances Web Application Development
- Adobe Introduces Adobe Flash Catalyst CS5
- Open Source Alternatives to LiveCycle Data Services
- The Future of Software Development
- Our Flex Book is a Java Bestseller
- Adobe Turns Host
- Focus Washington TechView Discusses Open Government With Adobe Executive
- Jobs to Adobe: ‘Yer Stinkin’ Flash is Over-the-Hill. Get Over It.’
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Building a Zip Code Proximity Search with ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF