|Re: Resource.save(); omits attributes with default values [message #392892 is a reply to message #392890]
||Mon, 16 May 2005 19:23
| Ed Merks
Registered: July 2009
If a feature returns false for eIsSet, then the value won't be saved.
For "normal" features, this means that it won't serialize default
values. If you want it to serialize whenever it's set, even if it's set
to the default value, you can make the feature unsettable. This takes
more space (to record the extra state) and is not a great idea if you
can avoid it. Saving defaults is of little value...
Alan Canon wrote:
> I'm using Resource.save() to produce an XML representation of my object.
> The trouble I have is that when I specify a Default Value Literal for
> an attribute of my class in ecore, the value isn't coming out in my
> XML. I can interrogate the instance before I .save() it, and tell that
> the value is there.
> If I change the value of the attribute on my object to a non-default
> value, and save, then I see the attribute, with its non-default value
> in the XML. If I change it back to the default value, I don't. (The
> attribute does not appear at all.)
> What's the explanation for this behavior? Is there any way to get the
> attribute in every case, even if it's not the default?
Professional Support: https://www.macromodeling.com/
Powered by FUDForum
. Page generated in 0.02227 seconds