Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to define a Derived/Transient/Votaile Attribute in an EcoreModel (2.6M4)
How to define a Derived/Transient/Votaile Attribute in an EcoreModel (2.6M4) [message #509071] Thu, 21 January 2010 10:27 Go to next message
Heiko is currently offline HeikoFriend
Messages: 43
Registered: July 2009
Member
Hi,
I my model I have an abstract class with an attribute "pk",
and all subclasses have also an attribute like "personPk" or "carPk".
All these fields have everytime the same vale as "pk"
In my mind so it is usefull to define these as derived ...
I found the Bug entry
https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 an I see that
possible to define something with annotations and the detailEntry
settingDelegate, but I cant find an simple example or build it at my
self for a simple delegated attribute.
It isn't possible with the options from this bug?

Greetings
Heiko
Re: How to define a Derived/Transient/Votaile Attribute in an EcoreModel (2.6M4) [message #509103 is a reply to message #509071] Thu, 21 January 2010 07:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30653
Registered: July 2009
Senior Member
Heiko,

The bugzilla provides infrastructure for being able to contribute an
interpret for annotations, but doesn't contribute any specific
interpretters. For your simple case, it's probably just as well to
specialize the method bodies to delegate to getPk/setPk. That also
gives you an opportunity to produce notifications for these derived
features, if they're to be viewed in the UI.


Heiko wrote:
> Hi,
> I my model I have an abstract class with an attribute "pk",
> and all subclasses have also an attribute like "personPk" or "carPk".
> All these fields have everytime the same vale as "pk"
> In my mind so it is usefull to define these as derived ...
> I found the Bug entry
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 an I see that
> possible to define something with annotations and the detailEntry
> settingDelegate, but I cant find an simple example or build it at my
> self for a simple delegated attribute.
> It isn't possible with the options from this bug?
>
> Greetings
> Heiko
Re: How to define a Derived/Transient/Votaile Attribute in an EcoreModel (2.6M4) [message #509125 is a reply to message #509103] Thu, 21 January 2010 08:08 Go to previous messageGo to next message
Heiko is currently offline HeikoFriend
Messages: 43
Registered: July 2009
Member
Hi Ed,
thanks for your quick answer. :)
It's a pity, thats these simple thing its not possible to define in
Ecore and all things like notification will also be generated. :/

So I will write all the bodies.

Argh thats over 120 ^^

Greetings
Heiko



Am 21.01.2010 12:49, schrieb Ed Merks:
> Heiko,
>
> The bugzilla provides infrastructure for being able to contribute an
> interpret for annotations, but doesn't contribute any specific
> interpretters. For your simple case, it's probably just as well to
> specialize the method bodies to delegate to getPk/setPk. That also gives
> you an opportunity to produce notifications for these derived features,
> if they're to be viewed in the UI.
>
>
> Heiko wrote:
>> Hi,
>> I my model I have an abstract class with an attribute "pk",
>> and all subclasses have also an attribute like "personPk" or "carPk".
>> All these fields have everytime the same vale as "pk"
>> In my mind so it is usefull to define these as derived ...
>> I found the Bug entry
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 an I see that
>> possible to define something with annotations and the detailEntry
>> settingDelegate, but I cant find an simple example or build it at my
>> self for a simple delegated attribute.
>> It isn't possible with the options from this bug?
>>
>> Greetings
>> Heiko
Re: How to define a Derived/Transient/Votaile Attribute in an EcoreModel (2.6M4) [message #509141 is a reply to message #509125] Thu, 21 January 2010 13:51 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30653
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070709040104000704080201
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Heiko,

With dynamic templates it would be possible to write just the template
for the snippet to insert for the accessors for volatile features...

<%@ include file="*Class/getGenFeature.TODO.override.javajetinc*"
fail="alternative" %>
<%@ start %>
// TODO: implement this method to return the
'<%=genFeature.getFormattedName()%>' <%=genFeature.getFeatureKind()%>
// Ensure that you remove @generated or mark it @generated NOT
<%if (genFeature.isListType()) {%>
// The list is expected to implement
org.eclipse.emf.ecore.util.InternalEList and
org.eclipse.emf.ecore.EStructuralFeature.Setting
// so it's likely that an appropriate subclass of
org.eclipse.emf.ecore.util.<%if (genFeature.isMapType())
{%>EcoreEMap<%} else if (genFeature.isFeatureMapType())
{%>BasicFeatureMap<%} else {%>EcoreEList<%}%> should be used.
<%}%>
throw new UnsupportedOperationException();
<%@ end %><%//Class/getGenFeature.todo.override.javajetinc%>



Heiko wrote:
> Hi Ed,
> thanks for your quick answer. :)
> It's a pity, thats these simple thing its not possible to define in
> Ecore and all things like notification will also be generated. :/
>
> So I will write all the bodies.
>
> Argh thats over 120 ^^
>
> Greetings
> Heiko
>
>
>
> Am 21.01.2010 12:49, schrieb Ed Merks:
>> Heiko,
>>
>> The bugzilla provides infrastructure for being able to contribute an
>> interpret for annotations, but doesn't contribute any specific
>> interpretters. For your simple case, it's probably just as well to
>> specialize the method bodies to delegate to getPk/setPk. That also gives
>> you an opportunity to produce notifications for these derived features,
>> if they're to be viewed in the UI.
>>
>>
>> Heiko wrote:
>>> Hi,
>>> I my model I have an abstract class with an attribute "pk",
>>> and all subclasses have also an attribute like "personPk" or "carPk".
>>> All these fields have everytime the same vale as "pk"
>>> In my mind so it is usefull to define these as derived ...
>>> I found the Bug entry
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701 an I see that
>>> possible to define something with annotations and the detailEntry
>>> settingDelegate, but I cant find an simple example or build it at my
>>> self for a simple delegated attribute.
>>> It isn't possible with the options from this bug?
>>>
>>> Greetings
>>> Heiko
>

--------------070709040104000704080201
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Heiko,<br>
<br>
With dynamic templates it would be possible to write just the template
for the snippet to insert for the accessors for volatile features...<br>
<blockquote>&lt;%@ include file="<b>Class/getGenFeature.TODO.override.javajetinc</b> "
fail="alternative" %&gt;<br>
&lt;%@ start %&gt;<br>
Previous Topic:Make generated EMF classes implement Serializable
Next Topic:Huge DefaultOperationHistory
Goto Forum:
  


Current Time: Fri Nov 22 15:28:52 GMT 2019

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

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

Back to the top