Creating instance of domain EClass [message #964610] |
Tue, 30 October 2012 13:02  |
Eclipse User |
|
|
|
Hi again,
If I make a domain class:
EClass d = EcoreFactory.eINSTANCE.createEClass();
d.setName( "D" );
Is it possible to create an instance of this class programmatically, e.g.:
EObject dO = ... d ...
Help is appreciated!
|
|
|
|
Re: Creating instance of domain EClass [message #964622 is a reply to message #964615] |
Tue, 30 October 2012 13:07   |
Eclipse User |
|
|
|
Note, however, that the EClass must be in an EPackage so that its
factory is reachable.
On 2012-10-30 17:06:30 +0000, Christian W. Damus said:
> Hi, Peter,
>
> EObject dO = EcoreUtil.create(d);
>
> HTH,
>
> Christian
>
>
> On 2012-10-30 17:02:44 +0000, Peter Johnsen said:
>
>> Hi again,
>>
>> If I make a domain class:
>>
>> EClass d = EcoreFactory.eINSTANCE.createEClass();
>> d.setName( "D" );
>>
>> Is it possible to create an instance of this class programmatically, e.g.:
>>
>> EObject dO = ... d ...
>>
>> Help is appreciated!
|
|
|
Re: Creating instance of domain EClass [message #966781 is a reply to message #964622] |
Thu, 01 November 2012 04:19  |
Eclipse User |
|
|
|
Thank you Christian!
I actually tried using EcoreUtil.create(...) before posting on this forum, but I hadn't added the class to a package, and thus, it didn't work. Your second post addressed that.
Great, take care!
|
|
|
Powered by
FUDForum. Page generated in 0.13434 seconds