Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend] creating an element results in a List[Object](Xtend creates list not a single element)
[Xtend] creating an element results in a List[Object] [message #519779] Tue, 09 March 2010 22:43 Go to next message
Jonathan Rojas is currently offline Jonathan RojasFriend
Messages: 2
Registered: March 2010
Junior Member
Hello.

I have created a M2M transformation in Xtend , and a respective AOP advice to intercept this transformation:
The purpose of this is to change the port defined, in the normal workflow it is a Signal port, and in the AOP workflow I want it to be a different Port(TerminalPort).

This rule creates the "Actual" metaconcept and locates under the "actual" attribute of vhdlams::Association

create Vhdlams::Association CreateReferenceAssociationForportsFtoS2(Vhdlams::PortMap map,String formal, Hiles::Control Ctrl):
	setActual(CreateActualPartForBlocksFtoS2(Ctrl))
;


Defined Transformation, this is the ruled called from the previous rule
create Vhdlams::Actual CreateActualPartForBlocksFtoS2(Hiles::Control Ctrl) :
	setPort(Ctrl.to_port.createSignalPort())
;

Defined Aspect
around transformations::hiles::HelpersActual::CreateActualPartForBlocksFtoS2(Hiles::Control Ctrl) :
    let resp = new Vhdlams::Actual:
    if( some condition )then{
	resp.setPort(Ctrl.to_port.createTerminalPort())
    }else{
       ctx.proceed()
    }
;


Everithing seems to work, There are no compiling errors.
But when I execute the workflow, it throws the following Exception:

EvaluationException : Couldn't find operation 'setActual(List)' for Vhdlams::Association.

which is natural because I'm expecting a Vhdlams::Actual not a List[Object]

It seems that the aspect rule is creating a List and not a "Vhdlams::Actual".Even more weird is that if log the returned List there is always one element of type "Vhdlams::Actual"

Can anybody help me, I know a way to solve it would be, to change the rule the following, but it seems not quite correct( band aid, to a bigger Issue)

create Vhdlams::Association CreateReferenceAssociationForportsFtoS2(Vhdlams::PortMap map,String formal, Hiles::Control Ctrl):
	setActual(CreateActualPartForBlocksFtoS2(Ctrl).get(0))
;


Instead of that I would like to know why this is happening, is there a problem in the code? or is ti a Bug?

thanks for the help...
Re: [Xtend] creating an element results in a List[Object] [message #519834 is a reply to message #519779] Wed, 10 March 2010 07:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14722
Registered: July 2009
Senior Member
hello

{anyexpression}


(Curly Braces) construct a list. so the result of your if else expression is a list with one element. if you want to avoid this use normal braces

(anyexpression)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: [Xtend] creating an element results in a List[Object] [message #520921 is a reply to message #519779] Mon, 15 March 2010 19:26 Go to previous message
Jonathan Rojas is currently offline Jonathan RojasFriend
Messages: 2
Registered: March 2010
Junior Member
Thanks a lot

That really helped....
Previous Topic:how to link xpand in workflow file
Next Topic:Unknown ocl::uml::Constraint propery, variable, type or enumeration literal 'specification'
Goto Forum:
  


Current Time: Wed Oct 09 23:26:29 GMT 2024

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

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

Back to the top