/** * Returns the target class used to create a copy instance for the given instance object. * @param eObject the object to be copied. * @return the target class used to create a copy instance. * @since 2.10 */ protected EClass getTarget(EObject eObject) { return getTarget(eObject.eClass()); }
/** * Returns the target class used to create a copy instance for the given instance object. * @param eObject the object to be copied. * @return the target class used to create a copy instance. * @since 2.10 */ protected EClass getTarget(EObject eObject) { return getTarget(eObject.eClass()); }
EStructuralFeature.Setting setting = getTarget(eReference, eObject, copyEObject); if (setting != null)
EStructuralFeature.Setting setting = getTarget(eReference, eObject, copyEObject); if (setting != null)
/** * Called to handle the copying of an attribute; * this adds a list of values or sets a single value as appropriate for the multiplicity. * @param eAttribute the attribute to copy. * @param eObject the object from which to copy. * @param copyEObject the object to copy to. */ protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject) { if (eObject.eIsSet(eAttribute)) { if (FeatureMapUtil.isFeatureMap(eAttribute)) { FeatureMap featureMap = (FeatureMap)eObject.eGet(eAttribute); copyFeatureMap(featureMap); } else { EStructuralFeature.Setting setting = getTarget(eAttribute, eObject, copyEObject); if (setting != null) { copyAttributeValue(eAttribute, eObject, eObject.eGet(eAttribute), setting); } } } }
/** * 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. * @param eReference the feature to copy. * @param eObject the object from which to copy. * @param copyEObject the object to copy to. */ protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject) { if (eObject.eIsSet(eReference)) { EStructuralFeature.Setting setting = getTarget(eReference, eObject, copyEObject); if (setting != null) { Object value = eObject.eGet(eReference); if (eReference.isMany()) { @SuppressWarnings("unchecked") List<EObject> target = (List<EObject>)value; setting.set(copyAll(target)); } else { setting.set(copy((EObject)value)); } } } }
/** * Called to handle the copying of an attribute; * this adds a list of values or sets a single value as appropriate for the multiplicity. * @param eAttribute the attribute to copy. * @param eObject the object from which to copy. * @param copyEObject the object to copy to. */ protected void copyAttribute(EAttribute eAttribute, EObject eObject, EObject copyEObject) { if (eObject.eIsSet(eAttribute)) { if (FeatureMapUtil.isFeatureMap(eAttribute)) { FeatureMap featureMap = (FeatureMap)eObject.eGet(eAttribute); copyFeatureMap(featureMap); } else { EStructuralFeature.Setting setting = getTarget(eAttribute, eObject, copyEObject); if (setting != null) { copyAttributeValue(eAttribute, eObject, eObject.eGet(eAttribute), setting); } } } }
/** * 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. * @param eReference the feature to copy. * @param eObject the object from which to copy. * @param copyEObject the object to copy to. */ protected void copyContainment(EReference eReference, EObject eObject, EObject copyEObject) { if (eObject.eIsSet(eReference)) { EStructuralFeature.Setting setting = getTarget(eReference, eObject, copyEObject); if (setting != null) { Object value = eObject.eGet(eReference); if (eReference.isMany()) { @SuppressWarnings("unchecked") List<EObject> target = (List<EObject>)value; setting.set(copyAll(target)); } else { setting.set(copy((EObject)value)); } } } }
/** * Returns a setting for the feature and copy instance to be populated with the original object's source feature's value. * @param eStructuralFeature the source feature. * @return the target feature used to populate a copy instance. * @see #getTarget(EStructuralFeature) * @see #getTarget(EObject) * @since 2.10 */ protected EStructuralFeature.Setting getTarget(EStructuralFeature eStructuralFeature, EObject eObject, EObject copyEObject) { EStructuralFeature targetEStructuralFeature = getTarget(eStructuralFeature); return targetEStructuralFeature == null ? null : ((InternalEObject)copyEObject).eSetting(targetEStructuralFeature); }
/** * Returns a setting for the feature and copy instance to be populated with the original object's source feature's value. * @param eStructuralFeature the source feature. * @return the target feature used to populate a copy instance. * @see #getTarget(EStructuralFeature) * @see #getTarget(EObject) * @since 2.10 */ protected EStructuralFeature.Setting getTarget(EStructuralFeature eStructuralFeature, EObject eObject, EObject copyEObject) { EStructuralFeature targetEStructuralFeature = getTarget(eStructuralFeature); return targetEStructuralFeature == null ? null : ((InternalEObject)copyEObject).eSetting(targetEStructuralFeature); }
/** * Returns a new instance of the object's target class. * @param eObject the object to copy. * @return a new instance of the target class. * @see #getTarget(EObject) * @see EcoreUtil#create(EClass) */ protected EObject createCopy(EObject eObject) { EClass eClass = getTarget(eObject); return eClass == null ? null : create(eClass); }
/** * Returns a new instance of the object's target class. * @param eObject the object to copy. * @return a new instance of the target class. * @see #getTarget(EObject) * @see EcoreUtil#create(EClass) */ protected EObject createCopy(EObject eObject) { EClass eClass = getTarget(eObject); return eClass == null ? null : create(eClass); }