Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Initialize an attribute with another attribute
Initialize an attribute with another attribute [message #422350] Tue, 02 September 2008 13:25 Go to next message
Guillaume SOLDERA is currently offline Guillaume SOLDERAFriend
Messages: 23
Registered: July 2009
Junior Member
Hi all !

I have a question ; is it possible to initialize an attribute with another
attribute value in a EMF model ?

Example :
I have an attribute 'ServerId'. Its default value is 0.
I hava an attribute 'ServerName'.
I would like that default value for 'ServerName' equals 's'+ Server_id
(here = s0).

Is is possible to do that ?

Thanks

Guillaume
Re: Initialize an attribute with another attribute [message #422351 is a reply to message #422350] Tue, 02 September 2008 13:32 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Guillaume,

Comments below.

Guillaume SOLDERA wrote:
> Hi all !
>
> I have a question ; is it possible to initialize an attribute with
> another attribute's value in a EMF model ?
I suppose anything is possible in code, but there's no way to declare
that in Ecore.
>
> Example : I have an attribute 'ServerId'. Its default value is 0.
> I hava an attribute 'ServerName'.
> I would like that default value for 'ServerName' equals 's'+ Server_id
> (here = s0).
You can set the EAttributes default value literal to "s0" if you like...
>
> Is is possible to do that ?
You could define the feature to be unsettable and you could specialize
the isSetX and getX methods to compute a default and to reflect when
the value is just a default... I'm not sure if you'd want to keep the
two in sync or produce notification when the ID changes...
>
>
> Thanks
>
> Guillaume
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Initialize an attribute with another attribute [message #422352 is a reply to message #422351] Tue, 02 September 2008 13:55 Go to previous message
Guillaume SOLDERA is currently offline Guillaume SOLDERAFriend
Messages: 23
Registered: July 2009
Junior Member
Hi Ed !

Thanks for your answer.
I just want put this pattern for the initialization. So I initialize with
's0' value.

But, in 'set' method, if there is no value, then I apply my pattern.

Thanks again

Guillaume

Ed Merks wrote:

> Guillaume,

> Comments below.

> Guillaume SOLDERA wrote:
>> Hi all !
>>
>> I have a question ; is it possible to initialize an attribute with
>> another attribute's value in a EMF model ?
> I suppose anything is possible in code, but there's no way to declare
> that in Ecore.
>>
>> Example : I have an attribute 'ServerId'. Its default value is 0.
>> I hava an attribute 'ServerName'.
>> I would like that default value for 'ServerName' equals 's'+ Server_id
>> (here = s0).
> You can set the EAttributes default value literal to "s0" if you like...
>>
>> Is is possible to do that ?
> You could define the feature to be unsettable and you could specialize
> the isSetX and getX methods to compute a default and to reflect when
> the value is just a default... I'm not sure if you'd want to keep the
> two in sync or produce notification when the ID changes...
>>
>>
>> Thanks
>>
>> Guillaume
>>
Previous Topic:XSD key-keyref support revisited
Next Topic:CDO offline mode
Goto Forum:
  


Current Time: Fri Apr 26 01:39:21 GMT 2024

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

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

Back to the top