Class UMLCopier

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<org.eclipse.emf.ecore.EObject,​org.eclipse.emf.ecore.EObject>

    public class UMLCopier
    extends org.eclipse.emf.ecore.util.EcoreUtil.Copier
    Utility class that should be used to copy UML model objects.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Summary

      • Fields inherited from class org.eclipse.emf.ecore.util.EcoreUtil.Copier

        resolveProxies, useOriginalReferences
    • Constructor Summary

      Constructors 
      Constructor Description
      UMLCopier()
      Creates an instance.
      UMLCopier​(boolean resolveProxies)
      Creates an instance that resolves proxies or not as specified.
      UMLCopier​(boolean resolveProxies, boolean useOriginalReferences)
      Creates an instance that resolves proxies or not and uses non-copied references or not as specified.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.eclipse.emf.ecore.EObject copy​(org.eclipse.emf.ecore.EObject eObject)
      Returns a copy of the given eObject.
      protected void copyContainment​(org.eclipse.emf.ecore.EReference eReference, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyEObject)
      Called to handle the copying of a containment feature; this adds a list of copies or sets a single copy as appropriate for the multiplicity.
      protected void copyReference​(org.eclipse.emf.ecore.EReference eReference, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EObject copyEObject)
      Called to handle the copying of a cross reference; this adds values or sets a single value as appropriate for the multiplicity while omitting any bidirectional reference that isn't in the copy map.
      void copyReferences()
      Hooks up cross references; it delegates to copyReference.
      • Methods inherited from class org.eclipse.emf.ecore.util.EcoreUtil.Copier

        copyAll, copyAttribute, copyAttributeValue, copyFeatureMap, copyProxyURI, createCopy, getTarget, getTarget, getTarget, getTarget
      • Methods inherited from class java.util.LinkedHashMap

        clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
    • Constructor Detail

      • UMLCopier

        public UMLCopier()
        Creates an instance.
      • UMLCopier

        public UMLCopier​(boolean resolveProxies)
        Creates an instance that resolves proxies or not as specified.
        Parameters:
        resolveProxies - whether proxies should be resolved while copying.
      • UMLCopier

        public UMLCopier​(boolean resolveProxies,
                         boolean useOriginalReferences)
        Creates an instance that resolves proxies or not and uses non-copied references or not as specified.
        Parameters:
        resolveProxies - whether proxies should be resolved while copying.
        useOriginalReferences - whether non-copied references should be used while copying.
    • Method Detail

      • copy

        public org.eclipse.emf.ecore.EObject copy​(org.eclipse.emf.ecore.EObject eObject)
        Returns a copy of the given eObject.
        Overrides:
        copy in class org.eclipse.emf.ecore.util.EcoreUtil.Copier
        Parameters:
        eObject - the object to copy.
        Returns:
        the copy.
      • copyReferences

        public void copyReferences()
        Hooks up cross references; it delegates to copyReference.
        Overrides:
        copyReferences in class org.eclipse.emf.ecore.util.EcoreUtil.Copier
      • copyContainment

        protected void copyContainment​(org.eclipse.emf.ecore.EReference eReference,
                                       org.eclipse.emf.ecore.EObject eObject,
                                       org.eclipse.emf.ecore.EObject copyEObject)
        Called to handle the copying of a containment feature; this adds a list of copies or sets a single copy as appropriate for the multiplicity.
        Overrides:
        copyContainment in class org.eclipse.emf.ecore.util.EcoreUtil.Copier
        Parameters:
        eReference - the feature to copy.
        eObject - the object from which to copy.
        copyEObject - the object to copy to.
      • copyReference

        protected void copyReference​(org.eclipse.emf.ecore.EReference eReference,
                                     org.eclipse.emf.ecore.EObject eObject,
                                     org.eclipse.emf.ecore.EObject copyEObject)
        Called to handle the copying of a cross reference; this adds values or sets a single value as appropriate for the multiplicity while omitting any bidirectional reference that isn't in the copy map.
        Overrides:
        copyReference in class org.eclipse.emf.ecore.util.EcoreUtil.Copier
        Parameters:
        eReference - the reference to copy.
        eObject - the object from which to copy.
        copyEObject - the object to copy to.