|Re: [henshin-user] Problem accessing single nodes of a match in henshin|
Hi Florian, |
thanks for your question.
On 13.08.2018 16:46, Florian Kunz wrote:
This is more or less about how EMF works. There are two ways of dealing with models with EMF: Static and dynamic EMF. In the bank example, for easy deployment, we use dynamic EMF. That is, the meta-model is loaded from an XMI file, rather than from an Eclipse plug-in (as in static EMF).
Since we use dynamic EMF, all model elements have the type "DynamicEObjectImpl". All required information can be retrieved by using reflection: First, get the EClass of the DynamicEObjectImpl by using the .eClass() method of the object. The EClass has methods to retrieve all attributes, and to retrieve a specific attribute based on its name. Finally, you can get the attribute values of your DynamicEObjectImpl by using its .eGet(attribute) method.
In real use-cases of Henshin, you normally avoid the nastiness of dealing with reflection, by using static EMF in the first place. In the bank example, you would have "Bank" and "Customer" objects rather than "DynamicEObjectImpls".
Generally, you can find information on Henshin's usage on the Wiki: https://wiki.eclipse.org/Henshin The particular questions seems to be more of an EMF question.
Back to the top