Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] Error "Couldn't find property 'a' for type 'b::c'" when "a" is EDataType
[Xpand] Error "Couldn't find property 'a' for type 'b::c'" when "a" is EDataType [message #662163] Tue, 29 March 2011 15:02 Go to next message
Christoph Wienands is currently offline Christoph WienandsFriend
Messages: 55
Registered: July 2009
Member
Hello all,

I'm pulling my hair trying to figure out what is going on. We have a number of Xpand templates that operate on a metamodel. This metamodel was imported from an XSD and we can't really change it for compatibility.

In the .xpt files we are seeing a lot of error messages like "Couldn't find property 'a' for type 'b::c'". We found out that this only happens for properties that are of EDataType. Now, all these EDataType have "float" or other simple data types set. The EMF genmodel generator is smart enough to map this to "short" or other simple datatypes without the need for an intermediate class. However, Xpand does not seem smart enough to do that.

Previously with the Galileo version we would see error messages in the editor but the templates still were executed properly. So for that time we simply ignored the errors. However, we recently upgraded to Helios and switched to "org.eclipse.xpand2", and now even the template expansion does not work anymore.

I have done some research and found this bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=281269 that seems related even though it is about Xtend.

Unfortunately, I don't understand how the workaround can be implemented, particularly for Xpand templates. All I found when searching for "JavaBeansMetaModel" were statements like "you need to use this" but never how this is done.

Could someone tell me how I can work with attributes of EDataType in Xpand templates, using the "JavaBeansMetaModel" workaround or any other way?

Thanks a lot, Christoph

[Updated on: Tue, 29 March 2011 15:07]

Report message to a moderator

Re: [Xpand] Error "Couldn't find property 'a' for type 'b::c'" when "a" is EData [message #662174 is a reply to message #662163] Tue, 29 March 2011 15:41 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

The EMF typesystem is not aware of handling EDataTypes. It only knows how to handle primitives or references. EDataTypes are just "Object".

When using the JavaBeansMetaModel this maps to Java classes, i.e. a class is a type, JavaBeans properties are properties, all other methods are operations. The namespace is not the NS prefix, it's the java package (foo::bar::something). This needs adjustments in templates, since EMF types and Java types behave slightly different.

To use the JavaBeansMetaModel just register org.eclipse.xtend.type.impl.java.JavaBeansMetaModel instead of the EmfRegistryMetaModel in the workflow, that's all.

In EMF classes produced for the EDataTypes they would map to their instance class, i.e. the datatypes are resolved to real types. So using the JavaBeansMetaModel would work here.

Kind regards,
~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: [Xpand] Error "Couldn't find property 'a' for type 'b::c'" when "a" is EData [message #662190 is a reply to message #662174] Tue, 29 March 2011 16:29 Go to previous messageGo to next message
Christoph Wienands is currently offline Christoph WienandsFriend
Messages: 55
Registered: July 2009
Member
Great, now I understand. I'll add a little bit more detail for anybody else having the same problem.

In my case, I am executing the Xpand template from Java code. So I replaced the EmfMetaModel creation with a JavaBeansMetaModel creation in the Java code.

Then I also had to go to the Preferences -> Xtend/Xpand and active the JavaBeansMetaModel contributor so that the error messages in the Xpand editor would disappear.

Last question: If I have multiple metamodel contributors enabled, how does the Xpand editor know which one to use for a particular .xpt file?

Thanks, Christoph
Re: [Xpand] Error "Couldn't find property 'a' for type 'b::c'" when "a" is EData [message #662288 is a reply to message #662190] Wed, 30 March 2011 06:10 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14735
Registered: July 2009
Senior Member
Hi,

The Xpand Editor and the Generator are intended to chain the Metamodels (and thus Contributors) in their configured order.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:M2T transformation for Android Applications
Next Topic:[Acceleo3] properties file
Goto Forum:
  


Current Time: Mon Dec 09 01:11:59 GMT 2024

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

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

Back to the top