Fornax-Platform
Forum

[JavaBasic] Why any class should implement java.io.Serializable?

View: New views
3 Messages — Rating Filter:   Alert me  

[JavaBasic] Why any class should implement java.io.Serializable?

by Nils Kelleter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I update the version of the JavaBasicCartridge and wonder why all classes should implement java.io.Serializable.

The change is made in revision 4655 in file fornax-cartridges-uml2-javabasic-generator\src\main\resources\org\fornax\cartridges\uml2\javabasic\m2t\Realization.xpt

Can anyone explain me this change? I know that I can overwrite this with an AOP template, but before I do this, I want to know the background of this change.

Regards,

Nils

Re: [JavaBasic] Why any class should implement java.io.Serializable?

by Darius Jockel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Nils,

Nils Kelleter wrote:
..., I update the version of the JavaBasicCartridge and wonder why all classes should implement java.io.Serializable.
Hm, you are right. I think only classes you want to persist should implement java.io.Serializable,
e.g. "Entities".

Is there any UML2 Flag like persistent or transient?

Regards
Darius

Re: [JavaBasic] Why any class should implement java.io.Serializable?

by Nils Kelleter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Darius,

Darius Jockel wrote:
Hm, you are right. I think only classes you want to persist should implement java.io.Serializable,
e.g. "Entities".
I think you could say in more general that only classes which you want to serialize should implement java.io.Serializable. ;-) Serialization is not only needed with peristence also for transfer/remoting. I think the decision, for which classes you need the interface (e.g. entities, transfer objects), is project specific and should be configured with an AOP-Template. So I think it is reasonable, that the template in the JavaBasicCartridge should be rolled back to the old version.

Regards

Nils