Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [XCore] derived feature, manual code
[XCore] derived feature, manual code [message #912025] Wed, 12 September 2012 20:14 Go to next message
M. Herrmann is currently offline M. HerrmannFriend
Messages: 25
Registered: March 2010
Junior Member
Hi,

this might be a noob question, but concerning EMF and XCore I AM probably a noob Smile

Lets say I have this in XCore:

class Entity {
transient derived String entityId get {
// do something to get the value and return it
}
}

And I also have

featureDelegation="Reflective" in the @GenModel properties.

If I look at the genrated getter in "EntityImpl", it does not contain the code specified in XCore but a call to "eGet" instead (actually I expected that)

Since I cannot change the generated code, how do I implement my custom code for the derived feature?
Let me add: I would really like it to be a feature, not use an operation instead.

I am forced to use featureDelegation="Reflective"

Something else:
Could you give me a hint how to use the "generation gap" pattern with XCore?
Especially how to get the factories to create my custom class instead of the generated class? Of course without manually changing the generated code.

Thanks for your help



[Updated on: Wed, 12 September 2012 20:26]

Report message to a moderator

Re: [XCore] derived feature, manual code [message #912144 is a reply to message #912025] Thu, 13 September 2012 02:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26217
Registered: July 2009
Senior Member
Looking at the templates, there are several cases where the condition
for generating the method body are guarded by earlier checks that will
produce alternative code. While testing this out, I noticed that even a
derived proxy resolving (no local keyword) will not emit the body
specified in the Xcore. Please open a bugzilla; perhaps there's still
time to fix this in the maintenance stream due to be released later this
month.



On 12/09/2012 10:14 PM, M. Herrmann wrote:
> Hi,
>
> this might be a noob question, but concerning EMF and XCore I AM
> probably a noob :)
>
> Lets say I have this in XCore:
>
> class Entity {
> transient derived String entityId get {
> // do something to get the value and return it
> }
> }
>
> And I also have
> featureDelegation="Reflective" in the @GenModel properties.
>
> If I look at the genrated getter in "EntityImpl", it does not contain
> the code specified in XCore but a call to "eGet" instead (actually I
> expected that)
>
> Since I cannot change the generated code, how do I implement my custom
> code for the derived feature?
>
> I am forced to use featureDelegation="Reflective"
>
> Something else:
> Could you give me a hint how to use the "generation gap" pattern with
> XCore?
> Especially how to get the factories to create my custom class instead
> of the generated class? Of course without manually changing the
> generated code.
>
> Thanks for your help
>
>
>
>
Re: [XCore] derived feature, manual code [message #912183 is a reply to message #912144] Thu, 13 September 2012 05:13 Go to previous messageGo to next message
M. Herrmann is currently offline M. HerrmannFriend
Messages: 25
Registered: March 2010
Junior Member
So intention is, that the body specified in the XCore overrides any default implementation, no matter what type of featureDelegation?
Re: [XCore] derived feature, manual code [message #912224 is a reply to message #912183] Thu, 13 September 2012 06:47 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26217
Registered: July 2009
Senior Member
Yes, although for dynamic delegation, reflective calls to eGet will
bypass any logic in the generated accessors, so that doesn't really work
well even if we generate the body properly. For reflective delegation
is should be supported because it's properly supported when you hand
modify the generated implementation. Your problem is related to
https://bugs.eclipse.org/bugs/show_bug.cgi?id=385634. But this is a
little trickier because the implementation should be in the basicGet and
it shouldn't resolve the proxy.


On 13/09/2012 7:13 AM, M. Herrmann wrote:
> So intention is, that the body specified in the XCore overrides any
> default implementation, no matter what type of featureDelegation?
Previous Topic:Comparing EObjects with EcoreUtils
Next Topic:[CDO] - exportChanges and detached Objects
Goto Forum:
  


Current Time: Mon Nov 24 21:52:34 GMT 2014

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

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