Class EMFLoadHelper
java.lang.Object
org.palladiosimulator.commons.emfutils.EMFLoadHelper
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 Summary
Modifier and TypeMethodDescriptionstatic StringgetResourceFragment(EObject eObject) Returns the URI fragment of a given eObject.static StringgetResourceURI(EObject eObject) Creates a resource URI for a given EObject; including its fragment that uniquely identifies the EObject within the resource.static EObjectloadAndResolveEObject(String resourceURI) Loads the EObject specified by the given resource URI.static EObjectloadAndResolveEObject(ResourceSet resourceSet, String resourceURI) static EObjectloadAndResolveEObject(ResourceSet resourceSet, URI modelURI)
-
Method Details
-
loadAndResolveEObject
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 thegetResourceURI(...)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
-
loadAndResolveEObject
-
getResourceURI
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
Returns the URI fragment of a given eObject.- Parameters:
eObject- the eObject to look the fragment up for.- Returns:
- the fragment of the eObject.
-