| Summary: | DefaultTransientValueService: Consider derived features as transient | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Karsten Thoms <karsten.thoms> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | moritz.eysholdt |
| Version: | 1.0.1 | ||
| Target Milestone: | --- | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
why would you want that? I think the derived-flag should not have an impact on serialization... If a derived features should not be persisted, one should mark it as "transient" in Ecore. Use case: My customer defines his metamodel in UML (don't argue here!) and uses the UML importer to create the Genmodel. There is no way here to mark features transient, but some relationships are marked as derived, since this is actually what is needed (and transient does not hit the intention also). And this setting is transformed to EMF with the importer. Counter-question: Why should a derived feature ever be persisted? Which negative impact would it have to adjust the DefaultTransientValueService. (In reply to comment #2) > Use case: My customer defines his metamodel in UML (don't argue here!) and uses > the UML importer to create the Genmodel. There is no way here to mark features > transient, but some relationships are marked as derived, since this is actually > what is needed (and transient does not hit the intention also). And this > setting is transformed to EMF with the importer. It's just that "derived" has noting to with "transient". If it would mean the same, there would only be one flag in EMF ;) That customer is free to register his own TransientValueService in which derived features are considered as transient. > Counter-question: Why should a derived feature ever be persisted? If you define an Xtext grammar for an Ecore model that has been generated from XSD. Then, EMF generates feature-Maps to preserve the order among values that belong the different features. Therefore, all features in the EClass except for the featuremap are marked derived. Xtext, however, doesn't support to access the feature map directly but only the individual (derived) features. |
The DefaultTransientValueService should also return true for isTransient is the feature is derived. public boolean isTransient(EObject owner, EStructuralFeature feature, int index) { return feature.isTransient() || feature.isDerived() ||