You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metamodel.apache.org by Apache Wiki <wi...@apache.org> on 2013/07/19 14:36:43 UTC

[Metamodel Wiki] Update of "MigratingFromEobjectsMetaModel" by KasperSorensen

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Metamodel Wiki" for change notification.

The "MigratingFromEobjectsMetaModel" page has been changed by KasperSorensen:
https://wiki.apache.org/metamodel/MigratingFromEobjectsMetaModel

New page:
= Migrating from eobjects.org MetaModel =

In it's previous incarnation, !MetaModel was hosted and developed not at Apache, but at http://metamodel.eobjects.org. With the move to Apache, we're also changing the namespace of !MetaModel to '''org.apache.metamodel''' instead of '''org.eobjects.metamodel'''. Obviously this causes migration issues, but on this page is a compilation of tips to overcome them.

== Quick migration: Search/replace ==

If you're a light user of !MetaModel, then probably a quick search/replace in your .java files will do the trick. Here's the common things to search for and replace with

||'''Search for'''||'''Replace with'''||
||import org.eobjects.metamodel||import org.apache.metamodel||
||import static org.eobjects.metamodel||import static org.apache.metamodel||

A broader search for ''org.eobjects.metamodel'' should also provide a good final check to see if you've missed any devils in the details.

== Deserializing legacy !MetaModel objects ==

If you've been relying on serialization of !MetaModel objects from the legacy codebase, you will encounter troubles when deserializing them. To alleviate this issue we provide a specialized !ObjectInputStream class that transparently deserializes legacy objects into their new format. This class is called '''!LegacyDeserializationObjectInputStream'''.

Here's a simple example of it's usage:

{{{#!java
Object obj;
FileInputStream fileIn = new FileInputStream("my_legacy_metamodel_object.ser");
try {
    ObjectInputStream ois = new LegacyDeserializationObjectInputStream(fileIn);
    obj = ois.readObject();
    ois.close();
} finally {
    FileHelper.safeClose(fileIn);
}
}}}