Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF - Default Valued Feature
EMF - Default Valued Feature [message #416701] Wed, 13 February 2008 14:17 Go to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 191
Registered: July 2009
Senior Member
Hi ,

Can anyone explain the behavior am facing,

I have an EMF model class as

Type A

- action
- active (true/false)
-name
- id

The features action/active are optional ones referring to an enum with
default values

When i dont set these features , they are not serialized with default
values.

I tried making them required even then they are not serialized

How do i make them serialzed with default values if i dont set any other
value to them ?

- Kamesh
Re: EMF - Default Valued Feature [message #416703 is a reply to message #416701] Wed, 13 February 2008 14:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Kamesh,

As discussed in the "Not able to persist Enum types" thread only yesterday
in this group, you can use the XMLResource.OPTION_KEEP_DEFAULT_CONTENT save
option when saving your resource to force it to save default values of
EAttributes.

However, this applies to all EAttributes in your resource, not just
enumerations. There isn't any way (that I know of) to specify that only a
single EAttribute should have its default values saved.

Ordinarily, however, it is not necessary to save defaults. The XSD for your
model encodes the defaults, so any compliant XML reader should be able to
understand the default values in your schema.

HTH,

Christian

Kamesh Sampath wrote:

> Hi ,
>
> Can anyone explain the behavior am facing,
>
> I have an EMF model class as
>
> Type A
>
> - action
> - active (true/false)
> -name
> - id
>
> The features action/active are optional ones referring to an enum with
> default values
>
> When i dont set these features , they are not serialized with default
> values.
>
> I tried making them required even then they are not serialized
>
> How do i make them serialzed with default values if i dont set any other
> value to them ?
>
> - Kamesh
Re: EMF - Default Valued Feature [message #416708 is a reply to message #416701] Wed, 13 February 2008 15:14 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Kamesh Sampath wrote:
> Hi ,
>
> Can anyone explain the behavior am facing,
> I have an EMF model class as
> Type A
>
> - action - active (true/false)
> -name
> - id
>
> The features action/active are optional ones referring to an enum with
> default values
> When i dont set these features , they are not serialized with default
> values.
>
> I tried making them required even then they are not serialized
>
> How do i make them serialzed with default values if i dont set any other
> value to them ?

This was asked and answered just yesterday. Please search the newsgroup
archives before posting new questions.
See the thread with subject "Not able to persist Enum types"

Eric
Re: EMF - Default Valued Feature [message #416711 is a reply to message #416703] Wed, 13 February 2008 17:01 Go to previous message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 191
Registered: July 2009
Senior Member
Hi Christian,

Thanks for the insight in to this feature. I was using it in the GMF when
the digaram serializes the EMF model , i found a work around i used the
Feature Seq Intiaitalizer in the Daigram to do the job, that works fine .

Anyways i got a new learning today :)

Cheers,
Kamesh
Previous Topic:Deleting markers
Next Topic:Custom property tab
Goto Forum:
  


Current Time: Tue Apr 23 11:14:39 GMT 2024

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

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

Back to the top