Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to make an element transient?
icon5.gif  How to make an element transient? [message #508479] Tue, 19 January 2010 06:52 Go to next message
Karthik Srinivasan is currently offline Karthik SrinivasanFriend
Messages: 9
Registered: July 2009
Junior Member
I have an xml that looks like this-
<parent type="x">
<child type="a"/>
<child type="b"/>
<child type="c"/>
</parent>

I have generated the ecore for that from the schema and I have an emf model from that.

At runtime on my emf model, I would like to make a specific child object (say <child type="b">) transient so that it is not serialized.

How do I go about doing that?
I tried childObject.eContainmentFeature().setTransient(true) where childObject is an instance that has type="b".
But that makes all the child objects as transient (i.e disappear when I serialize).

So I get -
<parent type="x"/>

Thanks,
Karthik

[Updated on: Tue, 19 January 2010 06:53]

Report message to a moderator

Re: How to make an element transient? [message #508604 is a reply to message #508479] Tue, 19 January 2010 15:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33218
Registered: July 2009
Senior Member
Karthik,

You can't make individual objects transient.


Karthik Srinivasan wrote:
> I have an xml that looks like this-
> <parent type="x">
> <child type="a">
> <child type="b">
> <child type="c">
> </parent>
>
> I have generated the ecore for that from the schema and I have an emf
> model from that.
>
> At runtime on my emf model, I would like to make a specific child
> object (say <child type="b">) transient so that it is not serialized.
>
> How do I go about doing that?
> I tried childObject.eContainmentFeature().setTransient(true) where
> childObject is an instance that has type="b".
> But that makes all the child objects as transient (i.e disappear when
> I serialize).
>
> So I get -
> <parent type="x"/>
>
> Thanks,
> Karthik


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to make an element transient? [message #511842 is a reply to message #508604] Wed, 03 February 2010 08:34 Go to previous message
Karthik Srinivasan is currently offline Karthik SrinivasanFriend
Messages: 9
Registered: July 2009
Junior Member
Thanks. I realized later that transient is a property of the feature and not of the individual objects. Should have realized that before posting the question. Razz

-Karthik

[Updated on: Wed, 03 February 2010 08:35]

Report message to a moderator

Previous Topic:[Announce] Eclipse Modeling Framework Component Builds
Next Topic:[Databiding] need basic tutorial with running example
Goto Forum:
  


Current Time: Thu Sep 26 07:28:33 GMT 2024

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

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

Back to the top