Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Unserialize
Unserialize [message #665943] Mon, 18 April 2011 09:36 Go to next message
Tidus is currently offline TidusFriend
Messages: 16
Registered: March 2011
Junior Member
Hello,

I just wanted to know what is the best way to serialize and unserialize emf object?
For example, I want to serialize an Eobject, i found this:
org.eclipse.emf.compare.util.ModelUtils.serialize


But for get back my object i only found this:
ResourceSet resSet = new ResourceSetImpl();
// Get the resource
EObject coucou = resSet.getEObject(URI.createURI("test.xmi"), true);
Resource resource = resSet.getResource(URI
					.createURI("myFile.xmi"), true);


However I need to write string content to a file to get my object back. But I don't want to use a File.

What can I do?

[Updated on: Mon, 18 April 2011 09:37]

Report message to a moderator

Re: Unserialize [message #666024 is a reply to message #665943] Mon, 18 April 2011 16:41 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Tidus,

I'd suggest looking at how the generated editor loads a model and how it
implements save. Or invoke Generate Test Code and look at how the
generated XyzExample.java in the *.tests project does it.


Tidus wrote:
> Hello,
>
> I just wanted to know what is the best way to serialize and
> unserialize emf object?
> For example, I want to serialize an Eobject, i found this:
> rg.eclipse.emf.compare.util.ModelUtils.serialize
>
> But for get back my object i only found this:
> ResourceSet resSet = new ResourceSetImpl();
> // Get the resource
> EObject coucou =
> resSet.getEObject(URI.createURI("test.xmi"), true);
> Resource resource = resSet.getResource(URI
> .createURI("myFile.xmi"), true);
>
> However I need to write string content to a file to get my object
> back. But I don't want to use a File.
>
> What can I do?


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:get EObject's EOperations
Next Topic:Create merged model using emf.compare ?
Goto Forum:
  


Current Time: Fri Apr 26 14:10:10 GMT 2024

Powered by FUDForum. Page generated in 0.04452 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top