0

serialVersionUID + ZK

asked 2014-06-30 08:04:02 +0800

IngoB gravatar image IngoB flag of Germany
256 6

updated 2014-06-30 08:15:42 +0800

Hi,

for some of my ZK Controller Classes (... extends GenericForwardComposer<component>) i have to use

private static final long serialVersionUID = XXX;

There are two options, "default" & "generated". I just want to know (if i don't serialize manually and/or have anything to do with it) if the "default / 1L" option is sufficient or do I should use a generated one?

Thanks

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-06-30 08:49:34 +0800

IngoB gravatar image IngoB flag of Germany
256 6

updated 2014-06-30 08:59:33 +0800

I read exactly this article before this post and it got me confused :<

Its not about "if" I should use it, it's about if "1L" or "generated" is sufficient.

link publish delete flag offensive edit

Comments

serialVersionUID is actually the version number of this class his serialisation. You need to change the number when you don't have backwards compability. The serialisation add the serialnumber to the serialised data. While deserialisation it will look at FQN and the serialVersionUID for correctness of the class, if not correct => ClassCastException. This means that 1L is indeed sufficient. If you don't use the Serialisation, it's actually even not needed to set it(But of course it's better to set it).

chillworld ( 2014-06-30 09:09:53 +0800 )edit
0

answered 2014-06-30 08:30:25 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9
https://github.com/chillw...

Ingo, try to understand the reason of the serialVersionUID and I think you can answer your own question :

http://stackoverflow.com/questions/285793/what-is-a-serialversionuid-and-why-should-i-use-it

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-06-30 08:04:02 +0800

Seen: 11 times

Last updated: Jun 30 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More