|Re: Do I need to generate the code of the meta model to explore/edit existing models [message #1811232 is a reply to message #1811227]
||Thu, 29 August 2019 09:11
| Ed Merks
Registered: July 2009
In general you do not need a generated model. But the data you read needs to (and does) specify the Ecore model(s) of the instance data. That's generally done via the namespace and generally the namespaces are registered in the EPackage.Registry.INSTANCE. However, the instance resource can be based on a dynamic Ecore model, in which case it will (generally must) specify the location of the Ecore model resource(s), using an xsi:schemaLocation attribute. In that case, the *.ecore models are read first, and then the instance resource is processed.|
Regardless of how the instance resource is specified, the loaded resource's getContents() is just an list of EObjects, and for any EObject x, you can use x.eClass() to determine its Ecore model.
Generated models can represent the instances more efficiently and of course then you have an API against which you can develop and application. But most of the EMF infrastructure does not care whether there is a generated model or not, and base all behavior on the API available for EObject/InternalEObject.
Professional Support: https://www.macromodeling.com/
Powered by FUDForum
. Page generated in 0.01827 seconds