進階自訂 > Services and Infrastructure Customization > Evolvable Classes > Hand-coded Externalization Guidelines
Hand-coded Externalization Guidelines
The following are guidelines for hand-coded externalization:
Use the version ID that is generated as the EXTERNALIZATION_VERSION_UID constant. This allows subclasses to use it for their own comparisons.
If you want to control the EXTERNALIZATION_VERSION_UID, you must model it and specify its initial value in the model. A modeled attribute supersedes the one provided by the code generator.
To calculate this version UID, the code generator uses the name of the parent class, and the names and types of all the non-transient, persistent fields.
It is prudent to manually control this value if the hand-coded externalization is not related to the signature, or footprint, of the non-transient, persistent fields of the class. (This occurrence should be rare.)
Do not model a serialVersionUIDattribute with a value other than 1 as this disallows the ability to read old versions of the class.
這是否有幫助?