Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Creating instance if only the EObject interface is known
Creating instance if only the EObject interface is known [message #1147903] Mon, 21 October 2013 05:57 Go to next message
Jens Rabe is currently offline Jens RabeFriend
Messages: 81
Registered: September 2013
Member
I am in a situation where I only know the fully-qualified class name of the interface of my EObject, like com.example.MyObject, and its contributing bundle. Now I need to create an instance of this object.

Is there a clean approach, preferably a true EMF way of doing this?

[Updated on: Mon, 21 October 2013 06:00]

Report message to a moderator

Re: Creating instance if only the EObject class is known [message #1148106 is a reply to message #1147903] Mon, 21 October 2013 09:06 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Jens,

There isn't a general way (utility provided by EMF) of working back from
a just a java.lang.Class instance for some generated interface to the
Ecore model for that thing. If you provide a bit more context of how
this problem arises I might be able to suggest strategies that make
sense. Generally you'll need to search the classifiers of EPackages for
ones with an instanceClass that matches and of course you could iterate
over all packages in the package registry, but that's considered bad
behavior in the IDE because if force starts all those bundles...


On 21/10/2013 7:57 AM, Jens Rabe wrote:
> I am in a situation where I only know the fully-qualified class name
> of the interface of my EObject, like com.example.MyObject, and its
> contributing bundle. Now I need to create an instance of this object.
>
> Is there a clean approach, preferably a true EMF way of doing this?


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Enforcing Uniqueness
Next Topic:Data Persistence in ELIST - ECLIPSE MODELING FRAMEWORK
Goto Forum:
  


Current Time: Thu Apr 25 17:22:47 GMT 2024

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

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

Back to the top