Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » String concatenation in MTL scripts(MTL - String concatenation )
String concatenation in MTL scripts [message #468482] Wed, 05 August 2009 16:06 Go to next message
Siegfried Nolte is currently offline Siegfried NolteFriend
Messages: 48
Registered: August 2009
Member
I'm trying some string concatenation in MTL scripts using the "+" operator:
[file ('file://'+c.name+'.java', false)]
This fails with "Cannot find operation (+(String)) for the type (String)".
Anybody any ideas?
Thanks for them,
Siegfried
Re: String concatenation in MTL scripts [message #477844 is a reply to message #468482] Thu, 06 August 2009 06:50 Go to previous messageGo to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
Hi Siegfried,
you have to use the concat method. Unfortunately, the + operator as a
shortcut for the concat method is not part of the MTL-standard. This is
the correct version of your example:
[file ('file://'.concat(c.name).concat('.java'), false)]

Greetings,
Max
Re: String concatenation in MTL scripts [message #477861 is a reply to message #477844] Thu, 06 August 2009 07:04 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070804020403060309020403
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi Siegfried, Max,

"concat" is indeed the correct way of concatening Strings in OCL. The
incoming version will add the "+" operator, but that's in the future :p.

Laurent Goubet
Obeo

Max Bureck a
Re: String concatenation in MTL scripts [message #477868 is a reply to message #477861] Thu, 06 August 2009 07:24 Go to previous messageGo to next message
Siegfried Nolte is currently offline Siegfried NolteFriend
Messages: 48
Registered: August 2009
Member
Hi Max, Laurent,

thanks to both of you for help.

@Max:
I took my example from the OMG's MTL specification.

Siegfried
Re: String concatenation in MTL scripts [message #478780 is a reply to message #477868] Thu, 06 August 2009 20:09 Go to previous messageGo to next message
Max Bureck is currently offline Max BureckFriend
Messages: 72
Registered: July 2009
Member
You're right. The + operator is used in the examples without specifying
it. Last time I checked it was not part of the OCL-standard, so it must be
specified explicitly. The QVT-standard, which also uses OCL declares this
shortcut explicitly (see page 38 for QVT/R and page 119 for QVT/OM). I
guess the authors of the standard simply forgot to declare the shortcut
for MTL.
Re: String concatenation in MTL scripts [message #478825 is a reply to message #478780] Fri, 07 August 2009 07:22 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060107080109000703060905
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi,

Most of the examples given in the MOFM2T specification sport at least
one syntax error, the "+" between Strings being one of the most
annoying. As I mentionned, the incoming version of OCL declares this
shortcut for "concat". Given that, I doubt the shortcut will also be
declared in the MOFM2T specification; we'll have to wait for OCL to get
updated.

Laurent Goubet
Obeo

Max Bureck a
Previous Topic:Update Site for the JET editor
Next Topic:Generating a JSP JET2 template
Goto Forum:
  


Current Time: Thu Apr 25 23:12:47 GMT 2024

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

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

Back to the top