Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[henshin-dev] Type parameters

Hi,

I thought a bit more about the type parameters problem. I think now that it can be very useful and relatively easy integrated into Henshin. Let me give you an example. Say we want to model the refactoring "PullUpAttribute". Now the idea is that we do not do it for a specific metamodel but genericly for a set of types which will be given at runtime. Depending on which types we pass to the rule at runtime, we can realize the refactoring for, say, Ecore class models or UML class models (using the same rule!).

Here is a possible way to integrate it in Henshin. We add a new 0..n containment feature called "typeParameters" to the Unit class. The type of this reference would be EModelElement. It could be used e.g. to store EClasses, EReferences or EAttributes. These types are contained in the unit / rule and can be used as types of nodes, edges, attributes or parameters. In the runtime, we would add support for setting type parameter values in UnitApplication. So if we defined e.g. a type parameter "Class" for our refactoring, we could say in the rule application that this type parameter should be substituted with the type "EClass" from the Ecore metamodel (or "Class" from the UML metamodel).

Cheers,
Christian


Back to the top