|
|
|
|
|
|
|
|
Re: Create a new model (instance) that conforms to my metamodel in Java class [message #1685198 is a reply to message #1685177] |
Wed, 18 March 2015 18:56 |
Edouard R. Batot Messages: 100 Registered: March 2015 |
Senior Member |
|
|
Ok, well, you're going fast.
You'll excuse my precipitation, it's been a while I haven't used a forum.
I don't want to generate any Java code.
In a nutshell, I want to load an .ecore and its .xmi instances in order to play with. Everything is in the same project - and to start easy, in the same folder.
(Why ? I'm trying to build preconditions for a transformation plugin using ecore)
But wait a minute, I'll try what you told me.
I've got the tests and the reading open.
Thanks again.
[Updated on: Wed, 18 March 2015 18:58] Report message to a moderator
|
|
|
Re: Create a new model (instance) that conforms to my metamodel in Java class [message #1685236 is a reply to message #1685198] |
Wed, 18 March 2015 19:18 |
Edouard R. Batot Messages: 100 Registered: March 2015 |
Senior Member |
|
|
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
Map<String, Object> m = reg.getExtensionToFactoryMap();
m.put("xmi", new XMIResourceFactoryImpl());
m.put("ecore", new XMIResourceFactoryImpl());
ResourceSet resourceSet = new ResourceSetImpl();
[b]Ramified mm = new Ramified(resourceSet);
resourceSet.getPackageRegistry().put(
"RamRoot", mm.getRoot()
);[/b]
Resource resource = (Resource) resourceSet.createResource(URI.createFileURI("models/MyInstance.xmi"));
resource.load(null);
Registering the package explicitly from the "instance" I've built from the .ecore (and more precisly, its root EPackage).
This looks like what changed this day in a beautyfull one !
Thanks a lot Ed for your support !
Edouard
[Updated on: Wed, 18 March 2015 19:18] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03558 seconds