Class EMFLoadHelper
- java.lang.Object
-
- org.palladiosimulator.commons.emfutils.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 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 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
public static EObject loadAndResolveEObject(ResourceSet resourceSet, String resourceURI)
-
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.
-
-