You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split out of #106 (itself a follow-up to #99/#105) because it is materially larger than the other
reading-compatibility items and is really its own feature: supporting the EAnnotation.contents
containment feature requires a dynamic EObject implementation that ECoreNetto does not currently
have.
Problem
EAnnotation has a containment feature contents that holds arbitrary EObjects — for example an
OCL/Pivot AST, or any model element whose type is declared elsewhere. A serialized annotation looks
like:
#99/#105 added EAnnotation.references (a non-containment reference list) but not contents.
ECoreNetto has no dynamic EObject instance: every model class in ModelElement/ is a fixed
metamodel type (EClass, EAttribute, …). A <contents xsi:type="somepkg:SomeClass"> element would
need a general "create an instance of an arbitrary EClass" path that the fixed classes do not
provide, so contents is currently dropped on read.
Direction
Introduce a dynamic EObject (an EObjectImpl-style instance backed by its EClass, holding its
feature values reflectively) — the analogue of EMF's DynamicEObjectImpl.
Add a generic factory keyed by xsi:type that resolves the EClass (via the type's EPackage
nsURI + local name) and instantiates the dynamic object.
Deserialize EAnnotation.contents with that factory, recursively reading child elements and
attributes into the dynamic instance's feature values.
Notes / references
Reference implementation: org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/DynamicEObjectImpl.java, EcoreUtil.create(EClass), and the generic EFactoryImpl.create. EObjectImpl.eGet/eSet show the
reflective feature-value storage.
Context
Split out of #106 (itself a follow-up to #99/#105) because it is materially larger than the other
reading-compatibility items and is really its own feature: supporting the
EAnnotation.contentscontainment feature requires a dynamic
EObjectimplementation that ECoreNetto does not currentlyhave.
Problem
EAnnotationhas a containment featurecontentsthat holds arbitraryEObjects — for example anOCL/Pivot AST, or any model element whose type is declared elsewhere. A serialized annotation looks
like:
#99/#105 added
EAnnotation.references(a non-containment reference list) but notcontents.ECoreNetto has no dynamic
EObjectinstance: every model class inModelElement/is a fixedmetamodel type (
EClass,EAttribute, …). A<contents xsi:type="somepkg:SomeClass">element wouldneed a general "create an instance of an arbitrary
EClass" path that the fixed classes do notprovide, so
contentsis currently dropped on read.Direction
EObject(anEObjectImpl-style instance backed by itsEClass, holding itsfeature values reflectively) — the analogue of EMF's
DynamicEObjectImpl.xsi:typethat resolves theEClass(via the type'sEPackagensURI + local name) and instantiates the dynamic object.
EAnnotation.contentswith that factory, recursively reading child elements andattributes into the dynamic instance's feature values.
Notes / references
org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/impl/DynamicEObjectImpl.java,EcoreUtil.create(EClass), and the genericEFactoryImpl.create.EObjectImpl.eGet/eSetshow thereflective feature-value storage.
@feature.Npositional fragments and barexmi:idresolution), which do not need dynamic objects.
.ecore, but appears in tool-generated metamodels that embed OCL/Pivotannotations.