[Xtend] Wrong parameter type [message #525412] |
Tue, 06 April 2010 10:21  |
Eclipse User |
|
|
|
Still trying my m2m transformation with Xtend, I get a problem with types.
Quote: | import metamodel;
import relationnel;
extension metamodel::Extensions reexport;
extension object2relationnal::SQLExtensions reexport;
//takes a Package as parameter, and creating a Database from it
create relationnel::Base transform (metamodel::Package p) :
this.setTables(p.classes().createTable());
// transforms all classes into SQL tables
create relationnel::Table createTable (metamodel::Class c) :
this.setName(c.name) ->
this.setColumn(c.attributs().createColumn());
// create a Column for every attribute which is not a composition or agregation
create relationnel::Column createColumn(metamodel::Attribute a) :
this.setName(a.name) ->
this.setType(a.type.name);
|
On last line, I get "couldn't find operation 'setType(String)' for type 'relationnel::Column'
But type is an Eattribute of Column, points to Type (abstract), which is either a Domain or a Datatype.
All of those types have only one Eattribute, called name, of type EString (inherited).
So what is wrong ?
|
|
|
|
Re: [Xtend] Wrong parameter type [message #525598 is a reply to message #525412] |
Wed, 07 April 2010 02:21   |
Eclipse User |
|
|
|
I'm sorry, I made a dumb mistake writing my former post, type is a EReference, and references Type, it's not a EAttribute.
That is the complete message I get running the workflow.
0 INFO WorkflowRunner - --------------------------------------------------------------------------------------
0 INFO WorkflowRunner - EMF Modeling Workflow Engine 0.7.2, Build v200908120417
0 INFO WorkflowRunner - (c) 2005-2009 openarchitectureware.org and contributors
0 INFO WorkflowRunner - --------------------------------------------------------------------------------------
0 INFO WorkflowRunner - running workflow: C:/Documents and Settings/Lecourt/workspace/genCPP/src/object2relationnal/m2m.mwe
0 INFO WorkflowRunner -
281 INFO StandaloneSetup - Registering platform uri 'C:\Documents and Settings\Lecourt\workspace'
390 INFO StandaloneSetup - Adding dynamic EPackage 'http://www.example.org/metamodel' from 'platform:/resource/genCPP/src/metamodel/metamodel.ecore'
390 INFO StandaloneSetup - Adding dynamic EPackage 'http://relationnel/1.0' from 'platform:/resource/genCPP/src/metamodel/relationnel.ecore'
484 INFO CompositeComponent - Reader: Loading model from src/Model.xmi
500 INFO CompositeComponent - XtendComponent: executing 'object2relationnal::object2relationnal'
812 ERROR AbstractExpressionsUsingWorkflowComponent - Error in Component of type org.eclipse.xtend.XtendComponent:
EvaluationException : Couldn't find operation 'setType(String)' for relationnel::Column.
object2relationnal::object2relationnal.ext[671,25] on line 19 'this.setType(a.type.name)'
object2relationnal::object2relationnal.ext[462,28] on line 14 'c.attributs().createColumn()'
object2relationnal::object2relationnal.ext[284,25] on line 9 'p.classes().createTable()'
nofile[0,16] on line 1 'transform(model)'
812 ERROR WorkflowRunner - Workflow interrupted. Reason: Couldn't find operation 'setType(String)' for relationnel::Column.
812 ERROR WorkflowRunner - [ERROR]: Couldn't find operation 'setType(String)' for relationnel::Column.(Element: this.setType(a.type.name); Reported by: XtendComponent: executing 'object2relationnal::object2relationnal')
812 ERROR WorkflowRunner - [ERROR]: Couldn't find operation 'setType(String)' for relationnel::Column.(Element: this.setName(a.name)->this.setType(a.type.name); Reported by: XtendComponent: executing 'object2relationnal::object2relationnal')
812 ERROR WorkflowRunner - [ERROR]: Couldn't find operation 'setType(String)' for relationnel::Column.(Element: c.attributs().createColumn(); Reported by: XtendComponent: executing 'object2relationnal::object2relationnal')
812 ERROR WorkflowRunner - [ERROR]: Couldn't find operation 'setType(String)' for relationnel::Column.(Element: this.setColumn(c.attributs().createColumn()); Reported by: XtendComponent: executing 'object2relationnal::object2relationnal')
812 ERROR WorkflowRunner - [ERROR]: Couldn't find operation 'setType(String)' for relationnel::Column.(Element: this.setName(c.name)->this.setColumn(c.attributs().createColumn()); Reported by: XtendComponent: executing 'object2relationnal::object2relationnal')
812 ERROR WorkflowRunner - [ERROR]: Couldn't find operation 'setType(String)' for relationnel::Column.(Element: p.classes().createTable(); Reported by: XtendComponent: executing 'object2relationnal::object2relationnal')
812 ERROR WorkflowRunner - [ERROR]: Couldn't find operation 'setType(String)' for relationnel::Column.(Element: this.setTables(p.classes().createTable()); Reported by: XtendComponent: executing 'object2relationnal::object2relationnal')
812 ERROR WorkflowRunner - [ERROR]: Couldn't find operation 'setType(String)' for relationnel::Column.(Element: transform(model); Reported by: XtendComponent: executing 'object2relationnal::object2relationnal')
Weirdly, since yesterday, when running the workflow messages are in black and no more in red, and are displayed differently than before.
|
|
|
|
Re: [Xtend] Wrong parameter type [message #525610 is a reply to message #525606] |
Wed, 07 April 2010 03:47  |
Eclipse User |
|
|
|
I'm only interested in the name of the type.
To simplify modelisation, I created types in my source metamodel (GBool, GInteger, and so on), but I don't need that in my destination model, which I want to use to generate SQL. I only need the name, and with Xpand I'll print the according SQL type in my sql file.
Do you think I should modify my metamodel and have the EReference Type become a EAttribute (which would be a GString) ?
I thought I could just map the types from my source model into a generic Datatype, using type (the EReference) to keep the type, and name to keep (obviously) the name.
So having a GBool called isActive in my source model, in destination model I would get a Column, of type GBool, of name isActive, and I would use that in Xpand to generate my sql file.
I guess I understand where the problem lies, GBool doesn't exist as a type in my destination metamodel. As Type is abstract, and can be a Datatype, or a Domain, I have to think about it again.
|
|
|
Re: [Xtend] Wrong parameter type [message #525615 is a reply to message #525598] |
Wed, 07 April 2010 03:11  |
Eclipse User |
|
|
|
Maxime Lecourt schrieb:
> I'm sorry, I made a dumb mistake writing my former post, type is a
> EReference, and references Type, it's not a EAttribute.
So you can't set a string, because a Type is expected.
But "this.setType(a.type.name)" sets the type's name not the type.
Sven
--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
|
|
|
Powered by
FUDForum. Page generated in 0.04085 seconds