Handling of boolean attributes while serialization [message #1028396] |
Thu, 28 March 2013 03:49  |
Eclipse User |
|
|
|
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 03:56] by Moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04209 seconds