Closed oasuncion closed 1 year ago
equals method of TradistaObject is now implemented as follows:
hashcode method of TradistaObject is now implemented as follows: hashcode is calculated using fields of the composite key. If the object doesn't have a composite key, hashcode implementation of Object class is used.
Fields of a TradistaObject that are part of the business key must be annotated "Id".
In addition, on this ticket, TradistaObject class has been made Cloneable and clone() method of TradistaObjects have been implemented so only deep copies of mutable attributes are part of the clone. Also, getters of mutable attributes provide deep copies of them.
Whatever the business object is in Tradista, the following rule seems to be always verified:
For 2 objects:
Analyse and confirm that the below statement is correct for all objects. In such case, think about a generic implementation of the equals and hashcode methods, with usage of an abstract businessKey method that will be implemented by any Tradista object.
Such change will ease the maintenance of the application, we will have reliable equals/hashcode methods that will help in many situations.