[ATL] transform generic EList type in generic EMF class [message #1715164] |
Thu, 19 November 2015 12:22  |
Eclipse User |
|
|
|
Hello,
I try to transform an EMF model to another one. The source model has an
EMF generic class MyCollection<T>. This class contains a feature
contents : T with multiplicity=-1 and as type the generic type of
MyCollection.
Other defined classes in the model have features with the type
MyCollection and defining an explicit template type.
E.g. I have a EClass MyPackage with the containing feature classes :
MyCollection<MyClass>.
Now, when defining the ATL rules, I do not see the specific template
type for the feature which uses the generic type. In this example, the
feature classes of MyPackage instances is shown simply as MyCollection
without the template type. Furthermore, its containing feature classes
is of type EObject[0..*] and not EMyClass[0..*].
When executung the rules, theses collections are not considered.
I tried to cast the feature, but .asOclType() is not supported by ATL.
Are such generic types not supported by ATL?
How can I get these typed list features work?
Thank you for any hints and comments.
Best regards,
Joachim Engelhardt
|
|
|
|
|
|
Re: [ATL] transform generic EList type in generic EMF class [message #1715246 is a reply to message #1715239] |
Fri, 20 November 2015 09:01   |
Eclipse User |
|
|
|
Thank you for this answer. I now understand the error, but what could be the reason in this case to not trigger the rule Package2Package? I think, the type of the contents is not determined correctly. This is why I assume, that the generics of EMF do not work properly at this point.
I have another rule for the root model, which works for Packages, if I use it as follows:
rule MyProject2Model {
from
myProject: MyModel!MyProject
using {
projectPackages: Sequence(MyModel!MyPackage) = myProject.packages.contents;
}
to
umlElement: UML!Model (
name <- myProject.name,
packagedElement <- projectPackages
)
}
This works correctly. But adopting this to the Package2Package rule does not success. I don't know, why, but it seems, that this only works, because the feature assignment is outside the rule for the transformation; for instance: MyProject2Model uses Package2Package. It doesn't work, if Package2Package must use itself to transform the sequence.
Any ideas?
|
|
|
|
|
|
Re: [ATL] transform generic EList type in generic EMF class [message #1715805 is a reply to message #1715362] |
Thu, 26 November 2015 06:15  |
Eclipse User |
|
|
|
Thank you very much for your example. That ATL handles generics correctly let us search at the right place for the source of the problem.
We changed the compiler to EMFTVM. We also call the templates by Java code and adapted also these calls to use the Emft execution environment.
After all, it still doesn't work.
But then we found out, that some modifications in the generated EClass files broke the correct work of eIsSet(). This is why ATL didn't iterate through the whole model. In this case, the feature property was only set, if the appropriate getter was called first. But eIsSet() checks only the property itself.
However, thank you very much for your help.
|
|
|
Powered by
FUDForum. Page generated in 0.30407 seconds