|
Re: How to correctly compare EDataType? [message #1064893 is a reply to message #1064885] |
Fri, 21 June 2013 14:16 |
Ed Merks Messages: 33146 Registered: July 2009 |
Senior Member |
|
|
Michael,
Comments below.
On 21/06/2013 4:08 PM, Michael Vorburger wrote:
> Can anyone enlighten me why I have to do the horrible hack in
> https://github.com/vorburger/efactory/commit/3464ba71f6fc0d50e03f0bec428b2cf17fee3c88,
> 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
version.
> The problem which made me do this is illustrated by the
> https://github.com/vorburger/efactory/blob/master/com.googlecode.efactory.tests/src/com/googlecode/efactory/xcore/tests/XcoreTest.java
> - somehow an EcorePackage.Literals.EINT isn't always an
> EcorePackage.Literals.EINT, like a say java.lang.Integer is always an
> java.lang.Integer?
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
> http://blog2.vorburger.ch/2013/06/efactory-ii-xobjects-ehutn.html,
> 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)...
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03466 seconds