Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » Ecore: best practice for unmodelled "references"?(What's the best way to reference an unmodelled Java class?)
Ecore: best practice for unmodelled "references"? [message #1076523] Wed, 31 July 2013 14:17 Go to next message
Ed Staub is currently offline Ed StaubFriend
Messages: 12
Registered: July 2009
Junior Member
In Ecore, what's the best way to create a "reference" (EReference or EAttribute) to an unmodelled Java class?

Does one create a "stub" EPackage for the class's package, and import it?

This gets tedious when there are a lot of packages.
In that case, if there are multiple ecore models importing the same set of stub EPackages, does one then create a dummy super-package that imports all the others?
Re: Ecore: best practice for unmodelled "references"? [message #1076586 is a reply to message #1076523] Wed, 31 July 2013 15:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Ed,

Please use eclipse.tools.emf for EMF questions in the future. More
comments below.


On 31/07/2013 4:17 PM, Ed Staub wrote:
> In Ecore, what's the best way to create a "reference" (EReference or
> EAttribute) to an unmodelled Java class?
You can create an EClass or EDataType and set the instanceTypeName to
the fully qualified name of the existing Java class/interface. But keep
in mind that if you create an EClass wrapper, and you use it for an
EReference's eReferenceType (as opposed to say an EClass's eSuperTypes),
the actual instance value you put into that reference must implement
EObject/InternalEObject.
> Does one create a "stub" EPackage for the class's package, and import it?
>
> This gets tedious when there are a lot of packages.
> In that case, if there are multiple ecore models importing the same
> set of stub EPackages, does one then create a dummy super-package that
> imports all the others?
You can package up your wrapper EClasses and EDataTypes and for reuse as
you see fit.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore: best practice for unmodelled "references"? [message #1076606 is a reply to message #1076586] Wed, 31 July 2013 16:29 Go to previous message
Ed Staub is currently offline Ed StaubFriend
Messages: 12
Registered: July 2009
Junior Member
Thanks much. In the intervening hours I just switched to using Xcore, where "wraps" made it obvious what to do.
Previous Topic:XCore generators
Next Topic:Importing/opening XMI OMG file
Goto Forum:
  


Current Time: Tue Mar 19 04:08:57 GMT 2024

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

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

Back to the top