進階自訂 > Services and Infrastructure Customization > Evolvable Classes > Examples of Generated Externalization Code for Evolvable Classes > Example of a readVersion Method
  
Example of a readVersion Method
The generator generates a readVersion method that include a conditional block for each version/uid line in the mapping table, unless a developer has taken over maintenance of the method by setting preserve=yes. The final "else" block calls the old readOldVersion() method, to support externalization code that might already have been implemented in this method. For negative uids, the minus sign is converted to an underscore in the method name, since a dash is not a valid character in Java method names.
protected boolean readVersion( MyItem thisObject, ObjectInput input,

long readSerialVersionUID, boolean passThrough, boolean superDone )
throws IOException, ClassNotFoundException {

throws IOException, ClassNotFoundException {

//##begin readVersion%readVersion.body preserve=no

boolean success = true;

if ( readSerialVersionUID == 6676079877272797361L )

return readVersion6676079877272797361L( input, readSerialVersionUID,
superDone );

else

success = readOldVersion( input, readSerialVersionUID, passThrough,
superDone );

if (input instanceof wt.pds.PDSObjectInput)

wt.fc.EvolvableHelper.requestRewriteOfEvolvedBlobbedObject();

return success;

//##end readVersion%readVersion.body

}