1

I have 3 template for example:-

main, genA, genB

The genB module is a specification for genA and supposed to overwrite one template bar. The problem is, that if you call the overwritten template within genA it is not the template specified in genB.

Here are the simplified templates:-

main:-

[module main('http://www.eclipse.org/uml2/5.0.0/UML')]

[import genB /]

[template public generateElement(aClass : Class)]
[comment @main/]
[foo() /][bar() /]
[/template]

genA:-

[module generateA('http://www.eclipse.org/uml2/5.0.0/UML') extends genB]

[template public foo()]
[bar() /]
[/template]

[template public bar()]
barA
[/template]

genB:-

[module generateB('http://www.eclipse.org/uml2/5.0.0/UML') extends genA]

[template public bar() overrides bar]
barB
[/template]

the output is barAbarB so the call within genA is not overwritten. This behavior is mentioned in the docs. What would be the suggested way to overwrite the template ?

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
fehrlich
  • 2,497
  • 2
  • 26
  • 44

1 Answers1

0

"Static overriding feels like overriding in an object oriented language like Java but it is different because modules are not objects, they are more similar to namespaces" https://wiki.eclipse.org/Acceleo/FAQ#How_does_the_overriding_system_works_in_Acceleo_.3F You should try to use dynamic overriding.

krab
  • 442
  • 4
  • 4