Home » Modeling » Epsilon » [EOL] Get All Properties(How can I retrive the set of properties of any class)
[EOL] Get All Properties [message #759661] |
Tue, 29 November 2011 14:36 |
Vasco Sousa Messages: 23 Registered: September 2009 |
Junior Member |
|
|
Hi,
The situation is I'm importing a model into another,
but the meta-model is not fixed and I cannot know
the types and properties at code time.
So the big question is, how do I get the set of Properties
of a class (Attributes and References, separated or all
in one set)in EOL, much like the OCL getAllProperties().
I tried to search in the documentation and the forum
and don't seem to be able to find any information on
this matter.
best regards
Vasco Sousa
[Updated on: Tue, 29 November 2011 14:38] Report message to a moderator
|
|
| |
Re: [EOL] Get All Properties [message #760781 is a reply to message #760733] |
Mon, 05 December 2011 08:55 |
Steffen Zschaler Messages: 266 Registered: July 2009 |
Senior Member |
|
|
Hi Vasco,
A word of warning, though: You can use reflection, but I don't think any
of the higher-level Epsilon languages will be of too much use to you
then. Dimitris, correct me if I'm wrong, but ETL/EGL, etc. do not
support reflection on the language level.
So, you can write plain EOL and use reflection directly. I don't think
this is going to be any more convenient or efficient than using Java
directly.
Alternatively, you can use higher-order transformations (HOTs); that is
transformations that generate transformations. In your case, you could,
for example, write an EGL script that takes a metamodel and generates an
ETL script for instances of this metamodel. This way you can make full
use of the features of EGL/ETL, while still being able to adapt your
transformations to arbitrary metamodels in a systematic fashion.
Best,
Steffen
On 04/12/2011 22:28, Dimitris Kolovos wrote:
> Hi Vasco,
>
> Apologies for the late reply. You'll need to use EMF Reflection for
> this (assuming that you're working with EMF-based models). For
> example, if x is your object, you can use x.eClass().getEAttributes()
> / getEReferences() to get all the attributes/references. See
> http://download.eclipse.org/modeling/emf/emf/javadoc/2.6.0/org/eclipse/emf/ecore/EClass.html
> for more details on the API of EClass and please let us know if you
> need any further assistance with this.
>
> Cheers,
> Dimitris
|
|
|
Re: [EOL] Get All Properties [message #760963 is a reply to message #760781] |
Mon, 05 December 2011 18:00 |
Vasco Sousa Messages: 23 Registered: September 2009 |
Junior Member |
|
|
Hi,
Thanks Dimitris and Steffen,
this is exactly what I needed( actualy getEAllAttributes(), but it the same documentation ).
As for the HOT approach, it wold be nice to do HOT, but in this case I think it is overkill. The import process is really simple, so EOL is fine, readable and compact.
Cheers, see you next time,
Vasco
|
|
|
Goto Forum:
Current Time: Wed Sep 25 20:55:44 GMT 2024
Powered by FUDForum. Page generated in 0.04210 seconds
|