Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [xpand/xtend] xtend expression retuns a string between square brakets(xtend invocation retuns a string between square brakets)
[xpand/xtend] xtend expression retuns a string between square brakets [message #656993] Tue, 01 March 2011 10:06 Go to next message
Elisa Herrmann is currently offline Elisa HerrmannFriend
Messages: 3
Registered: March 2011
Junior Member
Hi

I have an xtend expression that is supposed to returns: String but it returns [String].

This is the xtend expression

import NETSTMM;

String datatypeconv(NETSTMM::Languages l,NETSTMM::DataTypeKind partype ):
if l.toString().trim()=='vbnet' then
	{if (partype!=null) then
		switch (partype.toString()) {
		case 'DateTime':'Date'
		case 'int':'Integer'
		case 'Bool':'Boolean'
		case 'decimal':'Decimal'
		default: partype.toString().trim()
		}
	else
		"String"
	}
else
	switch (partype.toString().trim()) {
	case 'Date':'DateTime'
	case 'String':'string'
	case 'Integer':'int'
	default: partype.toString() 
	} ;


this is the xpand template to call it

ByVal «M.NMthHasPar.PName» As «datatypeconv(M.NMBelongsMC.MCBelongsPr.PrLanguage,M.NMthHasPar.first().PType)» _


and this is the result

Quote:
ByVal Param1 As [String], _


but I need it to retuns
Quote:
ByVal Param1 As String, _


Any ideas?

Elisa
Re: [xpand/xtend] xtend expression retuns a string between square brakets [message #657005 is a reply to message #656993] Tue, 01 March 2011 10:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi,

the {} operator creates a List
{"a"} gets [a] if you call to String on it / it is printed in the template.

so with

if l.toString().trim()=='vbnet' then {
...
} else
...


you construct a list in the if case.

~Christian



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 01 March 2011 11:00]

Report message to a moderator

Re: [xpand/xtend] xtend expression retuns a string between square brakets [message #657034 is a reply to message #657005] Tue, 01 March 2011 12:14 Go to previous message
Elisa Herrmann is currently offline Elisa HerrmannFriend
Messages: 3
Registered: March 2011
Junior Member
Thanks Christian,

I have exechanged the "{}" for the "( )" and It works!

Elisa
Previous Topic:executeworkflow leading to out of memory error
Next Topic:[Acceleo 3] Overriding Templates
Goto Forum:
  


Current Time: Tue Apr 16 22:06:01 GMT 2024

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

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

Back to the top