|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractMap<K,V> java.util.HashMap<EObject,EObject> org.eclipse.emf.ecore.util.EcoreUtil.Copier
public static class EcoreUtil.Copier
A mapping building traverser of a collection of content trees
;
the map is from EObject
to EObject
, i.e., from original to copy;
use EcoreUtil.copy
or EcoreUtil.copyAll
to do routine copies.
Since this implementation extends a Map implementation, it acts as the result of the over all copy.
The client can call copy
and copyAll
repeatedly.
When all the objects have been copied,
the client should call copyReferences
to copy the appropriate
cross references
.
Copier copier = new Copier(); EObject result = copier.copy(eObject); Collection results = copier.copyAll(eObjects); copier.copyReferences();The copier delegates to
copyContainment
, copyAttribute
during the copy phase
and to copyReference
, during the cross reference phase.
This allows tailored handling through derivation.
Field Summary | |
---|---|
protected boolean |
resolveProxies
Whether proxies should be resolved during copying. |
protected boolean |
useOriginalReferences
Whether non-copied references should be used during copying. |
Constructor Summary | |
---|---|
EcoreUtil.Copier()
Creates an instance. |
|
EcoreUtil.Copier(boolean resolveProxies)
Creates an instance that resolves proxies or not as specified. |
|
EcoreUtil.Copier(boolean resolveProxies,
boolean useOriginalReferences)
Creates an instance that resolves proxies or not and uses non-copied references or not as specified. |
Method Summary | ||
---|---|---|
EObject |
copy(EObject eObject)
Returns a copy of the given eObject. |
|
|
copyAll(java.util.Collection<? extends T> eObjects)
Returns a collection containing a copy of each EObject in the given collection. |
|
protected void |
copyAttribute(EAttribute eAttribute,
EObject eObject,
EObject copyEObject)
Called to handle the copying of an attribute; this adds a list of values or sets a single value as appropriate for the multiplicity. |
|
protected void |
copyContainment(EReference eReference,
EObject eObject,
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 |
copyProxyURI(EObject eObject,
EObject copyEObject)
Copies the proxy URI from the original to the copy, if present. |
|
protected void |
copyReference(EReference eReference,
EObject eObject,
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 . |
|
protected EObject |
createCopy(EObject eObject)
Returns a new instance of the object's target class. |
|
protected EClass |
getTarget(EClass eClass)
Returns the target class used to create a copy instance for objects of the given source class. |
|
protected EStructuralFeature |
getTarget(EStructuralFeature eStructuralFeature)
Returns the target feature used to populate a copy instance from the given source feature. |
Methods inherited from class java.util.HashMap |
---|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
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 |
---|
equals, hashCode |
Field Detail |
---|
protected boolean resolveProxies
protected boolean useOriginalReferences
Constructor Detail |
---|
public EcoreUtil.Copier()
public EcoreUtil.Copier(boolean resolveProxies)
resolveProxies
- whether proxies should be resolved while copying.public EcoreUtil.Copier(boolean resolveProxies, boolean useOriginalReferences)
resolveProxies
- whether proxies should be resolved while copying.useOriginalReferences
- whether non-copied references should be used while copying.Method Detail |
---|
public <T> java.util.Collection<T> copyAll(java.util.Collection<? extends T> eObjects)
eObjects
- the collection of objects to copy.
public EObject copy(EObject eObject)
eObject
- the object to copy.
protected void copyProxyURI(EObject eObject, EObject copyEObject)
eObject
- the object being copied.copyEObject
- the copy being initialized.protected EObject createCopy(EObject eObject)
eObject
- the object to copy.
getTarget(EClass)
,
EcoreUtil.create(EClass)
protected EClass getTarget(EClass eClass)
eClass
- the source class.
getTarget(EStructuralFeature)
protected EStructuralFeature getTarget(EStructuralFeature eStructuralFeature)
eStructuralFeature
- the source feature.
getTarget(EClass)
protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject)
eReference
- the feature to copy.eObject
- the object from which to copy.copyEObject
- the object to copy to.protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject)
eAttribute
- the attribute to copy.eObject
- the object from which to copy.copyEObject
- the object to copy to.public void copyReferences()
copyReference
.
protected void copyReference(EReference eReference, EObject eObject, EObject copyEObject)
eReference
- the reference to copy.eObject
- the object from which to copy.copyEObject
- the object to copy to.
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |