Handling of boolean attributes while serialization [message #1028396] |
Thu, 28 March 2013 07:49 |
|
Hi,
Scenario:
I have a use case of reading from xmi to ecore model and then serializing it in xText model and then to a file.
Details:
Hence, i load emf model from xmi file.
There is attribute "public", type boolean in EClass "Attribute" which contains value "false" in the emf model.
Them xText grammer i have following rule:
Attribute returns Attribute:
(public?='public')? 'Attribute' name=ID
I am serializing this model to xtext representation in the file via following code:
Injector injector = Guice.createInjector(new ControllerDslRuntimeModule());
XtextResourceSet set = injector.getInstance(XtextResourceSet.class);
XtextResource xtextResource = (XtextResource) set.getResource(targeturi, true);
xtextResource.getContents().add(controllerForXText);
try {
// save it the new file
Map<Object, Object> optionsMap = SaveOptions.defaultOptions().toOptionsMap();
optionsMap.put(XtextResource.OPTION_ENCODING, "UTF-8");
xtextResource.save(optionsMap);
} catch (IOException e) {
e.printStackTrace();
}
Since in the model the value of public was false i expected that in the dsl file keyword "public" should not appear.
But it is always there.
What exactly what i am missing here ?
Any hint will be helpful.
Thanks and Regards,
Ashwani Kr Sharma
[Updated on: Thu, 28 March 2013 07:56] Report message to a moderator
|
|
|
|
Re: Handling of boolean attributes while serialization [message #1028411 is a reply to message #1028404] |
Thu, 28 March 2013 08:07 |
|
Hi,
I checked content of xmi file using Sample Reflective Ecore Model. The editor shows the value is false.
I also debugged and checked the value in the model. There also the value is false.
Once i serialize and then load the model again from persisted dsl file the value is read as true.
I am using xText 2.4.0
Can i do something as quick win or workaround?
Regards,
Ashwani Kr Sharma
[Updated on: Thu, 28 March 2013 08:23] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03537 seconds