Class EMFLoadHelper


  • public final class EMFLoadHelper
    extends Object
    This class provides static helper methods for accessing models during runtime. Models are stored in resources, identified by resource URIs. Concrete model elements are identified by their fragments.
    • Method Detail

      • loadAndResolveEObject

        public static EObject loadAndResolveEObject​(String resourceURI)
        Loads the EObject specified by the given resource URI. The resource URI has to include the concrete fragment that references the EObject; otherwise an EObject cannot be uniquely identified in a given resource. For example, the String "platform:/resource/myProject/default.usagemodel#_ieXlgKDrEeKjDcfkNgs1Gg" correctly includes a fragment while "platform:/resource/myProject/default.usagemodel" does not. Use the getResourceURI(...) method of this class in case you want to get a correct resource URI for a given EObject.
        Parameters:
        resourceURI - Resource URI to a given EObject (has to include fragment).
        Returns:
        The referenced EObject.
      • loadAndResolveEObject

        public static EObject loadAndResolveEObject​(ResourceSet resourceSet,
                                                    URI modelURI)
      • getResourceURI

        public static String getResourceURI​(EObject eObject)
        Creates a resource URI for a given EObject; including its fragment that uniquely identifies the EObject within the resource.
        Parameters:
        eObject - The given EObject.
        Returns:
        The URI String of the given object; including its fragment.
      • getResourceFragment

        public static String getResourceFragment​(EObject eObject)
        Returns the URI fragment of a given eObject.
        Parameters:
        eObject - the eObject to look the fragment up for.
        Returns:
        the fragment of the eObject.