Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » (no subject)
(no subject) [message #687177] Sat, 11 June 2011 09:05 Go to next message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
Is it possible to model an enumeration, where actually <code>null</code>
shall be returned for an attribute having this enumeration type, if no
value is set to the attribute before?

So I want a behavior like EBooleanObject is for EBoolean.
(no subject) [message #687179 is a reply to message #687177] Sat, 11 June 2011 10:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Enumerations always have a value, but Features can have optional
multiplicity so why not just use lowerBound=0 ?

Regards

Ed Willink


On 11/06/2011 10:05, exquisitus wrote:
> Is it possible to model an enumeration, where actually
> <code>null</code> shall be returned for an attribute having this
> enumeration type, if no value is set to the attribute before?
>
> So I want a behavior like EBooleanObject is for EBoolean.
(no subject) [message #687180 is a reply to message #687177] Sat, 11 June 2011 16:25 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
Yes, you can define an EDataType whose instance type name is the fully
qualified name of the generated enum and use that instead of the EEnum.


exquisitus wrote:
> Is it possible to model an enumeration, where actually
> <code>null</code> shall be returned for an attribute having this
> enumeration type, if no value is set to the attribute before?
>
> So I want a behavior like EBooleanObject is for EBoolean.


Ed Merks
Professional Support: https://www.macromodeling.com/
(no subject) [message #687182 is a reply to message #687179] Sun, 12 June 2011 11:22 Go to previous messageGo to next message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
> Enumerations always have a value, but Features can have optional
> multiplicity so why not just use lowerBound=0 ?
>
because even with lowerBound=0 and the feature is unset, I will get the
default value, and not null.
(no subject) [message #687184 is a reply to message #687182] Sun, 12 June 2011 12:45 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Which is why you need to call eIsSet to distinguish the two cases.

Regards

Ed Willink

On 12/06/2011 12:22, exquisitus wrote:
>
>> Enumerations always have a value, but Features can have optional
>> multiplicity so why not just use lowerBound=0 ?
>>
> because even with lowerBound=0 and the feature is unset, I will get
> the default value, and not null.
(no subject) [message #687436 is a reply to message #687177] Sat, 11 June 2011 10:03 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Enumerations always have a value, but Features can have optional
multiplicity so why not just use lowerBound=0 ?

Regards

Ed Willink


On 11/06/2011 10:05, exquisitus wrote:
> Is it possible to model an enumeration, where actually
> <code>null</code> shall be returned for an attribute having this
> enumeration type, if no value is set to the attribute before?
>
> So I want a behavior like EBooleanObject is for EBoolean.
(no subject) [message #687437 is a reply to message #687177] Sat, 11 June 2011 16:25 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
Yes, you can define an EDataType whose instance type name is the fully
qualified name of the generated enum and use that instead of the EEnum.


exquisitus wrote:
> Is it possible to model an enumeration, where actually
> <code>null</code> shall be returned for an attribute having this
> enumeration type, if no value is set to the attribute before?
>
> So I want a behavior like EBooleanObject is for EBoolean.


Ed Merks
Professional Support: https://www.macromodeling.com/
(no subject) [message #687439 is a reply to message #687179] Sun, 12 June 2011 11:22 Go to previous message
John Smith is currently offline John SmithFriend
Messages: 137
Registered: July 2009
Senior Member
> Enumerations always have a value, but Features can have optional
> multiplicity so why not just use lowerBound=0 ?
>
because even with lowerBound=0 and the feature is unset, I will get the
default value, and not null.
(no subject) [message #687441 is a reply to message #687182] Sun, 12 June 2011 12:45 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Which is why you need to call eIsSet to distinguish the two cases.

Regards

Ed Willink

On 12/06/2011 12:22, exquisitus wrote:
>
>> Enumerations always have a value, but Features can have optional
>> multiplicity so why not just use lowerBound=0 ?
>>
> because even with lowerBound=0 and the feature is unset, I will get
> the default value, and not null.
Previous Topic:model myself an EBooleanObject
Next Topic:[CDO] Importing EMF model into CDO repository
Goto Forum:
  


Current Time: Sat Apr 20 11:12:40 GMT 2024

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

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

Back to the top