Class UMLCopier

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.EObject>
org.eclipse.emf.ecore.util.EcoreUtil.Copier
com.nomagic.magicdraw.uml2.util.UMLCopier
All Implemented Interfaces:
Serializable, Cloneable, 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.
Version:
1.0
See Also:
  • Constructor Details

    • 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 Details

    • 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.
    • getSourceIterator

      protected Iterator<org.eclipse.emf.ecore.EObject> getSourceIterator(org.eclipse.emf.ecore.util.InternalEList<org.eclipse.emf.ecore.EObject> source)
    • addToTargetWhenBidirectional

      protected void addToTargetWhenBidirectional(org.eclipse.emf.ecore.EObject copyEObject, org.eclipse.emf.ecore.util.InternalEList<org.eclipse.emf.ecore.EObject> targetList, org.eclipse.emf.ecore.EReference eOpposite, int index, org.eclipse.emf.ecore.EObject copyReferencedEObject, UMLCopier.IndexTracker indexTracker)