Closed jean-merelis closed 1 year ago
First, thank you for your interest in this simple library.
I also apologize for the delay as I had to read and think about this.
But unfortunately I can't do what you asked, because the Tsid
class was made to be an immutable value object.
Anyway, thanks for making me read a lot about immutability, object values, wrappers (decorator, adapter, and proxy) and related best practices.
These are some of the readings that helped me make the decision:
https://stackoverflow.com/questions/12306651/why-would-one-declare-an-immutable-class-final-in-java https://www.infoworld.com/article/2073003/is-a-java-immutable-class-always-final-.html https://docs.oracle.com/javase/tutorial/essential/concurrency/imstrat.html https://medium.com/codex/you-should-be-using-value-objects-568b19b1df8d http://www.javapractices.com/topic/TopicAction.do?Id=29 https://martinfowler.com/bliki/ValueObject.html
Could you make the Tsid class extensible? Can you remove the final modifier from class and changing the number field from private to protected?
Use case: For some entities like Tenant and User I have specialized IDs that differentiate them from others.
To extend Tsid I had to copy the classes into my project and modify them, but I would like to use the original library for that.