Unserialize [message #665943] |
Mon, 18 April 2011 09:36 |
Tidus 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 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.04452 seconds