|[Xpand] Error when invoking a definition from Java with polymorphism [message #559942]
||Mon, 20 September 2010 13:45
| Stephan Krusche
Registered: August 2010
I have the following scenario: I work with 4 different versions of a meta model (MM1.ecore, MM2.ecore, MM3.ecore, MM4.ecore) and 1 general version (GMM.ecore) which should cover the common types of the 4 versions. All metamodels are defined in different files and MM1 to MM4 have references to GMM. (I didn't develop them so I am not able to change them)
GMM has types from which the other meta models inherit. So I have type A1, A2, A3 and A4 in MM1 ... MM4 which are all subtypes of type A specified in GMM. This is done via the ESuper Types property of the EClasses.
For each meta model I also have the corresponding Java classes in jar librarys (mm1.jar, mm2.jar, mm3.jar, mm4.jar, gmm.jar), so I am able to handle all these classes / types in my Java code.
Now I want to create a definition in an Xpand template for type A and invoke it in Java with e.g. type/class A1:
Xpand: file "gen.xpt"
«DEFINE main FOR A»
private void generate(A1 a1)
EmfMetaModel MM1 = new EmfMetaModel();
EmfMetaModel GMM = new EmfMetaModel();
XpandFacade facade = XpandFacade.create(this.context);
This invokation leads to the error message: "No Definition 'main for A1' could be found!" Internal error : element was null
If I add the following text into the Xpand template, it works:
«DEFINE main FOR A1»
Is there anything wrong in my code or does Xpand not support this specific scenario?
I am really despaired
Powered by FUDForum
. Page generated in 0.04059 seconds