Package com.nomagic.magicdraw.uml2.util
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:
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.eclipse.emf.ecore.util.EcoreUtil.Copier
resolveProxies, useOriginalReferences
-
Constructor Summary
ConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionprotected 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) 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
Hooks up cross references; it delegates tocopyReference
.protected Iterator<org.eclipse.emf.ecore.EObject>
getSourceIterator
(org.eclipse.emf.ecore.util.InternalEList<org.eclipse.emf.ecore.EObject> source) 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 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 classorg.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 tocopyReference
.- Overrides:
copyReferences
in classorg.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 classorg.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 classorg.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)
-