DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > AMF - Problems When Serializing Between Java and ActionScript

AMF - Problems When Serializing Between Java and ActionScript

Cornel Creanga user avatar by
Cornel Creanga
·
Jul. 30, 08 · Java Zone · Interview
Like (0)
Save
Tweet
10.82K Views

Join the DZone community and get the full member experience.

Join For Free

Below are some tips and tricks when dealing with serialization between Java and ActionScript. I’ve spent some time and encountered some frustrations (especially when I was too tired) trying to understand why the value is not properly sent over the wire so I decided to document all of my mistakes. Over the time I will edit this post to add new insights

  • if something seems wrong turn on debugging in services-config.xml
  • a property must have a public getter and setter in order to be serialized. I know that is strange (why should I have a setter when it’s not needed?) but that’s it. I do not like it all because sometimes it breaks encapsulation
  • you should take care to map the ActionScript class with the corresponding Java class using the metadata. For example [RemoteClass(alias="com.foo.model.MyClass")]
  • verify that the ActionScript object is included in the SWF file. If your project does not have a reference to the AS file then it will not be included in the resulting SWF so the Java class will be serialized to a generic object
  • you cannot serialize maps that have integers as keys See this bug
  • when serializing Hibernate entities be sure that all of them are initialized or use some kind of Open Session in View pattern - or better build a value object to contain only the data you really need.
  • a NULL number in Java is converted to 0 in ActionScript
  • a Long number from Java cannot be properly converted to Number in ActionScript - you will lose precision, so you should send it packed in a different way

From http://cornelcreanga.com/

Java (programming language) ActionScript Action Message Format

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Implementing One and Two Way SSL (Mutual Authentication) for MuleSoft Application
  • Build Cloud-Native Apps with AWS App Runner, Redis, and AWS CDK
  • How a Low-Code API Platform Delivers Developer Productivity
  • AMI and Snapshot Management Using AWS Lambda

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo