|Re: How to correctly compare EDataType? [message #1064893 is a reply to message #1064885]
||Fri, 21 June 2013 14:16
| Ed Merks
Registered: July 2009
On 21/06/2013 4:08 PM, Michael Vorburger wrote:
> Can anyone enlighten me why I have to do the horrible hack in
> or how to avoid / do correctly compare EDataType for equality?
There's always the possibility to have both the generated runtime
version of a package, as well as the dynamically loaded development time
> The problem which made me do this is illustrated by the
> - somehow an EcorePackage.Literals.EINT isn't always an
> EcorePackage.Literals.EINT, like a say java.lang.Integer is always an
Not sure about that statement, but yes, it's possible to end up with the
EPackage instances from
platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore, which looks
suspiciously just like the generated instance in EcorePackage.eINSTANCE.
> Or maybe what that kind of code really wants to do isn't comparing
> EDataType for equality, but their.. what, their InstanceClass(Name?)
> or InstanceTypeName?
It depends on what you're trying to accomplish. Generally if they're
not == they're different instances and hence different. Under what
circumstances would you want two such things to be considered "the
same"? Perhaps if the eDataType.getEPackage().getNsURI() values are
equal and the data type's names are the same. In that case it's very
likely they represent the runtime and development time versions of "the
same" data type.
> I stumbled over this in the context of
> when trying it out with Xcore.
Xcore consistently (I hope) tries to use the development time version of
the Ecore model whereas Ecore models creating with the Sample Ecore
Editor will tend to use the runtime version of Ecore (for the data types)...
Powered by FUDForum
. Page generated in 0.02268 seconds