Transform models independently of their corresponding metamodels [message #75490] |
Wed, 27 February 2008 16:13 |
Eclipse User |
|
|
|
Originally posted by: rivera.lcc.uma.es
Dear all,
I'm trying to transform Ecore models to another platform. Actually, I
would like to transform models whatever the metamodels it conforms to.
Taking Ecore as the metamodel, and using EObject and its operations (and
reflection) I can transform whatever model to my platform, since I
transform EObject to my platform's corresponding objects.
The problem is the reverse transformation, since I can transform from my
platform's corresponding objects to EObjects, but I can not (I don't
know how) set the EClass to the EObject. EObject has an operation named
"eClass" to obtain its metaclass and an operation "eSet" to set the
value of an attribute, but there is not an operation named "eSetEClass"
to set the corresponding eClass (something like changing its metaclass
from EObject to a specific one). Does anybody know how to handle it?
Thanks in advance,
Jose E. Rivera
|
|
|
Re: Transform models independently of their corresponding metamodels [message #75508 is a reply to message #75490] |
Wed, 27 February 2008 16:20 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Jose,
I'm not sure if this is an ATL question or a more general one. In the
latter case, you should create the right type of object up front.
InternalEObject has an eSetClass method, but if you are transforming to
a generated model, you need to create the right implementation class.
So you should use EcoreUtil.create(EClass) to create the right type of
instance up front...
Jose E. Rivera wrote:
> Dear all,
>
> I'm trying to transform Ecore models to another platform. Actually, I
> would like to transform models whatever the metamodels it conforms to.
> Taking Ecore as the metamodel, and using EObject and its operations
> (and reflection) I can transform whatever model to my platform, since
> I transform EObject to my platform's corresponding objects.
>
> The problem is the reverse transformation, since I can transform from
> my platform's corresponding objects to EObjects, but I can not (I
> don't know how) set the EClass to the EObject. EObject has an
> operation named "eClass" to obtain its metaclass and an operation
> "eSet" to set the value of an attribute, but there is not an operation
> named "eSetEClass" to set the corresponding eClass (something like
> changing its metaclass from EObject to a specific one). Does anybody
> know how to handle it?
>
> Thanks in advance,
> Jose E. Rivera
|
|
|
Re: Transform models independently of their corresponding metamodels [message #75611 is a reply to message #75508] |
Mon, 03 March 2008 09:07 |
Eclipse User |
|
|
|
Originally posted by: rivera.lcc.uma.es
Sorry,
I forgot to explicitly mention that I want to do it with ATL... Is there
something similar to EcoreUtil for ATL?
Thanks in advance
Ed Merks escribió:
> Jose,
>
> I'm not sure if this is an ATL question or a more general one. In the
> latter case, you should create the right type of object up front.
> InternalEObject has an eSetClass method, but if you are transforming to
> a generated model, you need to create the right implementation class.
> So you should use EcoreUtil.create(EClass) to create the right type of
> instance up front...
>
>
> Jose E. Rivera wrote:
>> Dear all,
>>
>> I'm trying to transform Ecore models to another platform. Actually, I
>> would like to transform models whatever the metamodels it conforms to.
>> Taking Ecore as the metamodel, and using EObject and its operations
>> (and reflection) I can transform whatever model to my platform, since
>> I transform EObject to my platform's corresponding objects.
>>
>> The problem is the reverse transformation, since I can transform from
>> my platform's corresponding objects to EObjects, but I can not (I
>> don't know how) set the EClass to the EObject. EObject has an
>> operation named "eClass" to obtain its metaclass and an operation
>> "eSet" to set the value of an attribute, but there is not an operation
>> named "eSetEClass" to set the corresponding eClass (something like
>> changing its metaclass from EObject to a specific one). Does anybody
>> know how to handle it?
>>
>> Thanks in advance,
>> Jose E. Rivera
|
|
|
Powered by
FUDForum. Page generated in 0.03340 seconds