Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Copying EObjects with readonly properties
Copying EObjects with readonly properties [message #419775] Fri, 06 June 2008 15:08 Go to next message
Sebastian Paul is currently offline Sebastian PaulFriend
Messages: 106
Registered: July 2009
Senior Member
Hi,

I want to create a deep copy. Currently I am using EcoreUtil.copy.
Unfortuantely, properties that are not changeable are not copied. The only
way I see is making the properties changeable and document the setters not
to use them.

Is there any other way?
The problem is similar to deserialization. This state can be recognized in
the setter, so that an exception can be thrown while the resource is not
loaded. What about copiying?

Kind regards, Sebastian
Re: Copying EObjects with readonly properties [message #419776 is a reply to message #419775] Fri, 06 June 2008 15:25 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Sebastian,

How about just suppressing the setters from the API to make it more
difficult to change them accidentally? You can do that with an
annotation as created by EcoreUtil.setSuppressedVisibility.


Sebastian wrote:
> Hi,
>
> I want to create a deep copy. Currently I am using EcoreUtil.copy.
> Unfortuantely, properties that are not changeable are not copied. The
> only way I see is making the properties changeable and document the
> setters not to use them.
>
> Is there any other way? The problem is similar to deserialization.
> This state can be recognized in the setter, so that an exception can
> be thrown while the resource is not loaded. What about copiying?
>
> Kind regards, Sebastian
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Copying EObjects with readonly properties [message #419836 is a reply to message #419776] Mon, 09 June 2008 08:00 Go to previous message
Sebastian Paul is currently offline Sebastian PaulFriend
Messages: 106
Registered: July 2009
Senior Member
Thank you, that's exactly what I wanted.
Previous Topic:[CDO]: simple usage scenario?
Next Topic:Problem with "external" GenModel when programmatically triggering the generator
Goto Forum:
  


Current Time: Thu Apr 25 00:34:20 GMT 2024

Powered by FUDForum. Page generated in 0.03103 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top