Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Generic clone/equals Methods  RSS feed

Devesh H Rao
Ranch Hand
Posts: 687
Hibernate jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have implemented the following generic copy/equals method in our base Value Object. Any value object extending from the base class will not need to provide for the same.

I am contemplating making them final, coz I do not want any extending classes to override the implementation. But it then takes away the freedom providing alternate behavior.

Can anyone tell me, if this is the right way to go about and not make the methods final in the base VO?

The only reason I see for not making them final is as above and do we really have reasons for implementing different clone/equals in a project. I belive the behaviour for clone or equals is a project standard and we either have deep/shallow copies/equals.

Please let me know if otherwise.
[ March 22, 2007: Message edited by: Devesh H Rao ]
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!