|
Re: [Acceleo 3] - Expression in <init> clause of template [message #650922 is a reply to message #650849] |
Thu, 27 January 2011 07:55 |
|
This is a multi-part message in MIME format.
--------------010403080802030400070306
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Luc,
There is no ternary operator in OCL. You have to use a regular "if else
endif" :
fullTableName : String = item.name + (if (isAuditTable) then '_AUDIT'
else '_NORMAL' endif);
Laurent Goubet
Obeo
On 26/01/2011 21:06, Luc De Graef wrote:
> Hello,
>
> I want to use the <init> clause of a template to initialize some
> variables based on the additional parameters.
>
>
> [template public ddl(item : Item, isAuditTable : Boolean, suffix : String)
> {
> tableName : String = item.name + 'xxx';
> fullTableName : String = item.name + (isAuditTable ? '_AUDIT' : '_NORMAL');
> }
> ]
>
>
> I get a compilation error 'unexpected tokens' on the use of
> (isAuditTable ? '...' : '...)
>
> Is there a way to use a 'conditional expression' in the init clause?
>
> Regards
> Luc
--------------010403080802030400070306
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------010403080802030400070306--
|
|
|
|
Re: [Acceleo 3] - Expression in <init> clause of template [message #650934 is a reply to message #650925] |
Thu, 27 January 2011 08:26 |
|
This is a multi-part message in MIME format.
--------------030502080006060104070101
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Yup, Acceleo is an implementation of the MOF Model to Text standard ...
but this itself heavily depends on OCL. Most of the "expressions" you
will use in Acceleo are in fact OCL expressions (augmented with our own
standard library operations).
We provide in the documentation (Help > Help Contents > Acceleo Model to
Text) a reference guide of the standard OCL operations. Though this
guide still sports some typos, you can use it in order to find your way
around OCL.
Laurent Goubet
Obeo
On 27/01/2011 09:19, Luc De Graef wrote:
> Thanks,
>
> I had looked into the MOF Model to Text Specification Guide, but I now
> realize I need to review the OCL specifications also...
>
> Regards,
> Luc
--------------030502080006060104070101
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------030502080006060104070101--
|
|
|
Powered by
FUDForum. Page generated in 0.03069 seconds