Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[41] Use EMF's intrinsicIDToEObjectMap if present
The previous commit (1f44029) completely disabled EMF's default getEObjectByID in favor of using our own JSONResourceImpl-specific id map. However there are cases where we still want to lookup elements by their intrinsic (modeled) id instead of the IDManager-provided one, without incurring the cost of an eAllContents() on failure. This change allows for this to work, as long as the JSONResourceImpl has been setup with a non-null intrinsicIDToEObjectMap. For example right after the resource creation: ((ResourceImpl) resource).setIntrinsicIDToEObjectMap(new HashMap<>()); Once this is done, any new object added to the resource will get its intrinsic id cached in this map (see ResourceImpl.attachedHelper()) and JsonResourceImpl.getEObjectById will find it there (if present) while still bypassing the whole eAllContents() search in super.getEObjectByID(id). Bug: #41 Signed-off-by: Pierre-Charles David <[email protected]>
- Loading branch information