Friday, 22 March 2013

Find internal and external references to EMF model elements



EcoreUtil provides utilities to retrieve and navigate through the content structure of a model instance. To generically access direct content of a model element EObject’s eAllContent method can be used. 


When it comes to non containment references eCrossReferences of a EObject is used. Here again EcoreUtil provides a set of utilities which help to manage cross references within a model instance. The nested class CrossReferencer is used to map all cross references within a tree of model elements. CrossReferencer is implemented as a Map which maps an EObject to a set of EStructuralFeature.Setting. Upon creation a CrossReferencer can be initialized with either a EObject, a Resource or a ResourceSet. CrossReferencer extends HashMap on lookup the a CrossRefernce maps

Slightly different implementations to lookup cross references are the classes ExternalCrossReferencerProxyCrossReferencer and UnresolvedProxyCrossReferencer.


No comments:

Post a Comment