serialization - How can I change package for a bunch of java serializable classes -


i want change packages of multiple classes in application. nice eclipse redactor have been great of classes serializables , need support cross version compatibility.

any idea on how can done? can done automatically/semi-automatically?

if class structure remains same, can subclass custom objectinputstream, call enableresolveobject(true) in constructor , override readclassdescriptor() that:

protected objectstreamclass readclassdescriptor() throws ioexception, classnotfoundexception {     objectstreamclass read = super.readclassdescriptor();     if (read.getname().startswith("com.old.package.")) {         return objectstreamclass.lookup(class.forname(read.getname().replace("com.old.package.", "org.new.package.")));     }     return read; } 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -