Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » How can I reuse the template from a super metaclass
How can I reuse the template from a super metaclass [message #1808717] Sat, 29 June 2019 23:08 Go to next message
Elder Rodrigues is currently offline Elder RodriguesFriend
Messages: 5
Registered: June 2019
Junior Member
Let's say that there are two metaclasses: MetaClassA and MetaClassB. MetaClassB is a submetaclass of MetaclassA and MetaClassA is not abstract. Therefore it is possible to create an instance of MetaClassA which is not kind of MetaClassB.

In the Acceleo code there will be something like this (same module):

[template tmpl (anElement: MetaClassA)]

[/template]

[template tmpl (anElement: MetaClassB)]

[/template]


Is it possible to reuse tmpl of MetaClassA inside the tmpl of MetaClassB?

I know it's possible to separate the templates into modules and then use the extends . However, in my metamodel there are some cases with multiple inheritance, so this approach would fail.

I have thinked in only one solution: creating a template for MetaClassA (e.g., tmplAReusable) and then call it inside tmplB. For example:

[template tmplAReusable (anElement: MetaClassA)]
...
[/template]

[template tmpl(anElement: MetaClassA)]
[anElement.tmplAReusable() /]
[/template]

[template tmpl(anElement: MetaClassB)]
[anElement.tmplAReusable() /]
...
[/template]


Any Suggestions?
Thanks.
Re: How can I reuse the template from a super metaclass [message #1808720 is a reply to message #1808717] Sun, 30 June 2019 05:13 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6481
Registered: July 2009
Senior Member
Hi

I can only recommend your solution.

Acceleo is based on MOFM2T 1.0. Once some enthusiasts appear to support a 1.1, rule re-use is an issue that might be addressed. For now, there is no OMG support team, and Acceleo is not under active development.

Regards

Ed Willink

[Updated on: Sun, 30 June 2019 08:10]

Report message to a moderator

Re: How can I reuse the template from a super metaclass [message #1808733 is a reply to message #1808720] Sun, 30 June 2019 13:58 Go to previous message
Elder Rodrigues is currently offline Elder RodriguesFriend
Messages: 5
Registered: June 2019
Junior Member
Sure, Thank you for the information
Previous Topic:Comparison for upperbound is not working
Next Topic:[Acceleo] Circular dependencies
Goto Forum:
  


Current Time: Tue Oct 15 12:08:41 GMT 2019

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

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

Back to the top