Skip to main content



      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 10:17 Go to next message
Eclipse UserFriend
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 11:54 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Ecore: best practice for unmodelled "references"? [message #1076606 is a reply to message #1076586] Wed, 31 July 2013 12:29 Go to previous message
Eclipse UserFriend
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: Sat Jul 05 22:00:29 EDT 2025

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

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

Back to the top