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
Nested Classes -
Field Summary
Fields inherited from class org.eclipse.emf.ecore.util.EcoreUtil.Copier
resolveProxies, useOriginalReferences -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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 voidaddToTargetWhenBidirectional(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.EObjectcopy(org.eclipse.emf.ecore.EObject eObject) Returns a copy of the given eObject.protected voidcopyContainment(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 voidcopyReference(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.voidHooks 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, getTargetMethods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
copyin 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:
copyReferencesin 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:
copyContainmentin 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:
copyReferencein 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)
-