1 | package de.uka.ipd.sdq.identifier.util; |
2 | |
3 | import org.eclipse.emf.ecore.EAttribute; |
4 | import org.eclipse.emf.ecore.EObject; |
5 | import org.eclipse.emf.ecore.util.EcoreUtil; |
6 | import org.eclipse.emf.ecore.util.EcoreUtil.Copier; |
7 | |
8 | import de.uka.ipd.sdq.identifier.Identifier; |
9 | import de.uka.ipd.sdq.identifier.IdentifierPackage; |
10 | |
11 | public class EObjectIDRespectingCopier extends Copier { |
12 | |
13 | /** |
14 | * |
15 | */ |
16 | private static final long serialVersionUID = -5643746361216087434L; |
17 | |
18 | @Override |
19 | protected void copyAttribute(EAttribute attribute, EObject object, |
20 | EObject copyEObject) { |
21 | if (attribute == IdentifierPackage.eINSTANCE.getIdentifier_Id()) { |
22 | ((Identifier) copyEObject).setId(EcoreUtil.generateUUID()); |
23 | } else { |
24 | super.copyAttribute(attribute, object, copyEObject); |
25 | } |
26 | } |
27 | |
28 | } |