问题
I want to know if it is possible to save self-written code within a generated file. If you change the model and then push the save button, all code is overwritten. I want to save some of the code of the old file.
回答1:
Xtend uses a source generating compiler thus the produced Java code for Xtend itself cannot be altered on the source level.
Nevertheless, if you use Xtend's template expression to generate code, you can of course insert protected regions to allow users to modify the generated code. This OS project on Github implements support for protected regions in Xtend.
来源:https://stackoverflow.com/questions/14263790/saving-self-written-code-xtend