0

When mapping Java data object to Flex value objects the code works even though the java classes do not implement Serializable.

So even though code will work without it, should it? As in is it good practise to make sure that all data object classes implement Serializable when you wish to use BlazeDS for mapping.

What are the benifits if any to implementing Serializable?

delp
  • 771
  • 11
  • 20
  • The shouldn't implement serializable, because blazeds libraries implement custom AMF serialization – Timofei Davydik Dec 03 '12 at 15:22
  • ok, I'm trying to find some evidence of this on the Adobe help but nothing appears clear cut. Do you have a link or something to confirm what you're saying. From previous experience all java classes have implemented it and I took it that it was required or at least recommended. But now I'm seeing some that don't so began to look into why and what is best practise. reading (apparent) conflicting answers. – delp Dec 03 '12 at 15:36
  • Read about java native serialization http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html http://www.tutorialspoint.com/java/java_serialization.htm It has nothing common with AMF serialization – Timofei Davydik Dec 03 '12 at 15:45

1 Answers1

1

The answer is NO. Serializable interface is used for Java native serialization. AMF serialization has nothing common with it and is used for serializing and deserializing Flash player data. Moreover you'll not find any information about Serializable in BlazeDS docs.

You can check, that AMF is implemented in BlazeDS libraries.

Timofei Davydik
  • 7,244
  • 7
  • 33
  • 59
  • So what about this. http://help.adobe.com/en_US/LiveCycleDataServicesES/3.1/Developing/WSc3ff6d0ea77859461172e0811f00f6eab8-7ffdUpdate.html Or would you say that in this case it is only used because of the custom serialization. – delp Dec 03 '12 at 16:18
  • Yes, I would :) Again, it's AMF serialization, and as you can see, nothing is said about Serializable interface – Timofei Davydik Dec 03 '12 at 16:27
  • Yes I seen that it has Externalizable, which is accroding to this answer http://stackoverflow.com/questions/817853/what-is-the-difference-between-serializable-and-externalizable-in-java very simialr to Serializable but created to handle performance issues with Seriablzable in the early days of Java. I'm for not using it, just want to get a very clear answer as to why? Thanks. – delp Dec 03 '12 at 16:36
  • Externalizable is used when you want to do some custom serialization. In your case you need neither Externalizable nor Serializable – Timofei Davydik Dec 03 '12 at 17:31
  • Yes, you've answered what I said, the adobe link extends the Externalizable because it uses custom serialization. (which might be required - unless you know something about the projects I'm working on that I don't :P ). but in general, its not required. – delp Dec 03 '12 at 23:48