Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to create an EString to set as EType for an EAttribute
How to create an EString to set as EType for an EAttribute [message #423975] Sun, 12 October 2008 18:46 Go to next message
Eclipse UserFriend
Originally posted by: mam05eux.studserv.uni-leipzig.de

Hello,

I´ve searched for a long time now and I didn´t find a way to get an
instance of EString to set it as the EType for a new created EAttribute.
Here is a snippet of my code:

EAttribute nameAttribute = fac.createEAttribute();
nameAttribute.setName("name");
nameAttribute.setLowerBound(1);
nameAttribute.setUnique(false);

//here I want to set the EType of the nameAttribute (with method
nameAttribute.setEType(.?.))
c.getEStructuralFeatures().add(nameAttribute);
//c is my EClass!

So, how can I get an instance of EString to set it there?
Thanks.
Re: How to create an EString to set as EType for an EAttribute [message #423979 is a reply to message #423975] Mon, 13 October 2008 07:15 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Stanley,

EcorePackage.eINSTANCE.getEString() gives you the EString EDataType instance.

Hallvard

Stanley Hillner wrote:

> EAttribute nameAttribute = fac.createEAttribute();
> nameAttribute.setName("name");
> nameAttribute.setLowerBound(1);
> nameAttribute.setUnique(false);
>
> //here I want to set the EType of the nameAttribute (with method
> nameAttribute.setEType(.?.))
> c.getEStructuralFeatures().add(nameAttribute);
> //c is my EClass!
> So, how can I get an instance of EString to set it there?
> Thanks.
Re: How to create an EString to set as EType for an EAttribute [message #423980 is a reply to message #423979] Mon, 13 October 2008 08:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mam05eux.studserv.uni-leipzig.de

Ok,

thanks a lot!
I just didn´t find it.

Stanley

Hallvard Trætteberg schrieb:
> Stanley,
>
> EcorePackage.eINSTANCE.getEString() gives you the EString EDataType
> instance.
>
> Hallvard
>
> Stanley Hillner wrote:
>
>> EAttribute nameAttribute = fac.createEAttribute();
>> nameAttribute.setName("name");
>> nameAttribute.setLowerBound(1);
>> nameAttribute.setUnique(false);
>>
>> //here I want to set the EType of the nameAttribute (with method
>> nameAttribute.setEType(.?.))
>> c.getEStructuralFeatures().add(nameAttribute);
>> //c is my EClass!
>> So, how can I get an instance of EString to set it there?
>> Thanks.
Re: How to create an EString to set as EType for an EAttribute [message #423987 is a reply to message #423980] Mon, 13 October 2008 15:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Stanley,

EcorePackage.Literals.ESTRING is a nice way too. It's a bit more efficient.


Stanley Hillner wrote:
> Ok,
>
> thanks a lot!
> I just didn´t find it.
>
> Stanley
>
> Hallvard Trætteberg schrieb:
>> Stanley,
>>
>> EcorePackage.eINSTANCE.getEString() gives you the EString EDataType
>> instance.
>>
>> Hallvard
>>
>> Stanley Hillner wrote:
>>
>>> EAttribute nameAttribute = fac.createEAttribute();
>>> nameAttribute.setName("name");
>>> nameAttribute.setLowerBound(1);
>>> nameAttribute.setUnique(false);
>>>
>>> //here I want to set the EType of the nameAttribute (with method
>>> nameAttribute.setEType(.?.))
>>> c.getEStructuralFeatures().add(nameAttribute);
>>> //c is my EClass!
>>> So, how can I get an instance of EString to set it there?
>>> Thanks.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[Teneo] lazy fetching of many to one associations
Next Topic:Synch Two models
Goto Forum:
  


Current Time: Sat Apr 27 01:08:36 GMT 2024

Powered by FUDForum. Page generated in 0.03161 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top