Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » xtend: m2m(rename class)
xtend: m2m [message #531028] Mon, 03 May 2010 08:47 Go to next message
Eclipse UserFriend
I am new to xtend and I have started with simple transformation by renaming a class. I have following xtend code for the transformation.

import uml;

uml::Model root(uml::Model m):
	
	let c=m.eAllContents.typeSelect(Class).selectFirst(e|e.name== "A"):
	renameClass(c)->m; 

Class renameClass(uml::Class c1):
	c1.setName("myNewClass");


but I am getting following error:
0    INFO  WorkflowRunner     - --------------------------------------------------------------------------------------
0    INFO  WorkflowRunner     - EMF Modeling Workflow Engine 1.0.0, Build v201003150825
0    INFO  WorkflowRunner     - (c) 2005-2009 openarchitectureware.org and contributors
0    INFO  WorkflowRunner     - --------------------------------------------------------------------------------------
0    INFO  WorkflowRunner     - running workflow: C:/Workspace/m2m.first.try/src/workflow_generator_refactorings/renameClass.mwe
0    INFO  WorkflowRunner     - 
1406 INFO  CompositeComponent - XmiReader: file 'model/test.uml' => slot 'modelSlot'
1609 INFO  CompositeComponent - DirectoryCleaner(dirCleaner): cleaning directory 'src-gen'
1609 INFO  CompositeComponent - XtendComponent: executing 'm2m::renameClass'
2124 ERROR AbstractExpressionsUsingWorkflowComponent - Error in Component  of type org.eclipse.xtend.XtendComponent: 
	EvaluationException : Couldn't find operation 'setName(String)' for uml::Class.
	m2m::renameClass.ext[191,24] on line 10 'c1.setName("myNewClass")'
	m2m::renameClass.ext[128,14] on line 6 'renameClass(c)'           
	nofile[0,20] on line 1 'root(modelSlot)'                     

2124 ERROR WorkflowRunner     - Workflow interrupted. Reason: Couldn't find operation 'setName(String)' for uml::Class.
2124 ERROR WorkflowRunner     - [ERROR]: Couldn't find operation 'setName(String)' for uml::Class.(Element: c1.setName("myNewClass"); Reported by: XtendComponent: executing 'm2m::renameClass')
2124 ERROR WorkflowRunner     - [ERROR]: Couldn't find operation 'setName(String)' for uml::Class.(Element: Class renameClass(uml::Class c1); Reported by: XtendComponent: executing 'm2m::renameClass')
2124 ERROR WorkflowRunner     - [ERROR]: Couldn't find operation 'setName(String)' for uml::Class.(Element: renameClass(c); Reported by: XtendComponent: executing 'm2m::renameClass')
2124 ERROR WorkflowRunner     - [ERROR]: Couldn't find operation 'setName(String)' for uml::Class.(Element: renameClass(c)->m; Reported by: XtendComponent: executing 'm2m::renameClass')
2124 ERROR WorkflowRunner     - [ERROR]: Couldn't find operation 'setName(String)' for uml::Class.(Element: let c=m.eAllContents.typeSelect(Class).selectFirst(e|e.name.==("A")) : renameClass(c)->m; Reported by: XtendComponent: executing 'm2m::renameClass')
2124 ERROR WorkflowRunner     - [ERROR]: Couldn't find operation 'setName(String)' for uml::Class.(Element: uml::Model root(uml::Model m); Reported by: XtendComponent: executing 'm2m::renameClass')
2124 ERROR WorkflowRunner     - [ERROR]: Couldn't find operation 'setName(String)' for uml::Class.(Element: root(modelSlot); Reported by: XtendComponent: executing 'm2m::renameClass')


can any one help me to resolve this problem

thanks,
Re: xtend: m2m [message #531047 is a reply to message #531028] Mon, 03 May 2010 10:02 Go to previous messageGo to next message
Eclipse UserFriend
Hi!

This is most likely a misconfiguration of your Generator component in the MWE workflow. The ProfileMetaModel must be registered first in the list of metamodel contributors to Xpand's Generator component. Since it is delegating to the EmfRegistryMetaModel itself there is no need to add this metamodel also. If you don't work with a profile, you would use the UML2MetaModel in the same way.

Kind regards,
~Karsten
Re: xtend: m2m [message #531055 is a reply to message #531047] Mon, 03 May 2010 10:26 Go to previous message
Eclipse UserFriend
Thanx karsten, I have removed EmfRegistryMetaModel and added UML2metamodel and it works fine.
Previous Topic:[Xpand] Calling expand statement with incremental parameter
Next Topic:Access to GMF domain file for C++/Java Code Generation
Goto Forum:
  


Current Time: Tue Jul 08 11:16:38 EDT 2025

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

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

Back to the top