| UUID eattribute conflicts in ECoreUtil.copy [message #986346] |
Tue, 20 November 2012 03:06  |
Paco Blanco Messages: 28 Registered: June 2012 |
Junior Member |
|
|
Hello,
I am using an EClass with a String EAttribute that relates to an UUID. I do not know if my way to set the UUID value is good but I initialize it in the constructor:
protected Constructor() {
super();
setUUID(EcoreUtil.generateUUID());
}
The setUUID is the setter autogenerated by the EMF generator code.
When I do a copy of an element using EcoreUtil.copy(EObject), I want the generated new element has a different UUID because this new element is a different instance. Unluckily, although the contructor sets a new value just generated, the Copier overwrittes the value with the same value of the element to copy.
My first attempt to solve it is to put the changeable property of the EAttribute to false and convert the attribute to a final variable. But I do not know to put the value of the generateUUID() to the attribute: the setter has been deleted (logically) but all types of eSet give me an exception around to impossible change the value of a not changeable feature.
Some solution?
[Updated on: Tue, 20 November 2012 03:21] Report message to a moderator
|
|
|