Class MetamodelUtils


  • public final class MetamodelUtils
    extends Object
    Helper methods for metamodel access.
    Version:
    $Rev$
    Author:
    herrmama, $Author$
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <V extends org.eclipse.emf.ecore.EModelElement>
      V
      copy​(V modelElement)
      Copy a metamodel element.
      static org.eclipse.emf.ecore.resource.ResourceSet createIndependentMetamodelCopy​(Collection<org.eclipse.emf.ecore.EPackage> rootPackages, org.eclipse.emf.common.util.URI metamodelURI)
      Create a copy of a set of packages that is independent of generated packages.
      static Collection<org.eclipse.emf.ecore.EPackage> getAllRootPackages​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
      Get all root packages in a resource set.
      static org.eclipse.emf.ecore.EReference getGenericReference​(org.eclipse.emf.ecore.EReference reference)
      Get the corresponding reference which is generic.
      static org.eclipse.emf.ecore.EReference getNonGenericReference​(org.eclipse.emf.ecore.EReference genericReference)
      Get the corresponding reference which is not generic.
      static org.eclipse.emf.ecore.EPackage getRootPackage​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
      Get any root package in a resource set.
      static boolean isConcrete​(org.eclipse.emf.ecore.EClass eClass)
      Check whether a class is concrete, i.e.
      static boolean isGenericReference​(org.eclipse.emf.ecore.EReference reference)
      Check whether a reference is of generic type.
      static boolean isMetamodelResource​(org.eclipse.emf.ecore.resource.Resource resource)
      Check whether the resource contains a metamodel.
      static boolean isMetamodelURI​(org.eclipse.emf.common.util.URI uri)
      Check whether the URI denotes a resource containing a metamodel.
      static List<org.eclipse.emf.ecore.EStructuralFeature> subtractFeatures​(org.eclipse.emf.ecore.EClass minuend, org.eclipse.emf.ecore.EClass subtrahend)
      Subtract the features that are provided by a class from the types that are provided by another class.
      static List<org.eclipse.emf.ecore.EClass> subtractTypes​(org.eclipse.emf.ecore.EClass minuend, org.eclipse.emf.ecore.EClass subtrahend)
      Subtract the types that are provided by a class from the types that are provided by another class.
    • Method Detail

      • isGenericReference

        public static boolean isGenericReference​(org.eclipse.emf.ecore.EReference reference)
        Check whether a reference is of generic type.
      • getNonGenericReference

        public static org.eclipse.emf.ecore.EReference getNonGenericReference​(org.eclipse.emf.ecore.EReference genericReference)
        Get the corresponding reference which is not generic.
      • getGenericReference

        public static org.eclipse.emf.ecore.EReference getGenericReference​(org.eclipse.emf.ecore.EReference reference)
        Get the corresponding reference which is generic.
      • copy

        public static <V extends org.eclipse.emf.ecore.EModelElement> V copy​(V modelElement)
        Copy a metamodel element. Do not copy opposites in case this might lead to an inconsistency.
      • getAllRootPackages

        public static Collection<org.eclipse.emf.ecore.EPackage> getAllRootPackages​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
        Get all root packages in a resource set.
      • isMetamodelResource

        public static boolean isMetamodelResource​(org.eclipse.emf.ecore.resource.Resource resource)
        Check whether the resource contains a metamodel.
      • isMetamodelURI

        public static boolean isMetamodelURI​(org.eclipse.emf.common.util.URI uri)
        Check whether the URI denotes a resource containing a metamodel.
      • getRootPackage

        public static org.eclipse.emf.ecore.EPackage getRootPackage​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
        Get any root package in a resource set.
      • isConcrete

        public static boolean isConcrete​(org.eclipse.emf.ecore.EClass eClass)
        Check whether a class is concrete, i.e. neither abstract nor an interface.
      • subtractTypes

        public static List<org.eclipse.emf.ecore.EClass> subtractTypes​(org.eclipse.emf.ecore.EClass minuend,
                                                                       org.eclipse.emf.ecore.EClass subtrahend)
        Subtract the types that are provided by a class from the types that are provided by another class.
      • subtractFeatures

        public static List<org.eclipse.emf.ecore.EStructuralFeature> subtractFeatures​(org.eclipse.emf.ecore.EClass minuend,
                                                                                      org.eclipse.emf.ecore.EClass subtrahend)
        Subtract the features that are provided by a class from the types that are provided by another class.
      • createIndependentMetamodelCopy

        public static org.eclipse.emf.ecore.resource.ResourceSet createIndependentMetamodelCopy​(Collection<org.eclipse.emf.ecore.EPackage> rootPackages,
                                                                                                org.eclipse.emf.common.util.URI metamodelURI)
        Create a copy of a set of packages that is independent of generated packages.