Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[41] Use EMF's intrinsicIDToEObjectMap if present #47

Merged
merged 1 commit into from
Jun 26, 2024

Commits on Jun 26, 2024

  1. [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]>
    pcdavid committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    55ef24b View commit details
    Browse the repository at this point in the history