Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » assigning a default value to an inherited property
assigning a default value to an inherited property [message #478439] Wed, 20 May 2009 14:43 Go to next message
Szymon is currently offline Szymon
Messages: 6
Registered: July 2009
Junior Member
Hi,

I am using uml2 and I have a problem with assigning a default value to an
inherited property.

In my uml model I have a class A with a property a. In a class B, which is
a child of A I would like to assign a default value for the property a. In
class B I use the same name for the property a.

When I try to generate the EMF model I get a warning "Discarded feature
'B::a' because it is a duplicate of inherited feature 'A::a'".
If I set the "Redefined Property" of B::a to point to A::a it is even
worse because I get an additional warning: "Feature 'B::a' should be
annotated as redefintion of feature 'A::a'".

Obviously when I generate a java code on the basis of my model the default
value is not assigned to the property a of class B.

Any idea how I could assign a default value to the property a of the class
B?

regards,
Szymon
Re: assigning a default value to an inherited property [message #478473 is a reply to message #478439] Thu, 28 May 2009 19:20 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn Hussey
Messages: 1618
Registered: July 2009
Senior Member
Szymon,

If you set the option for redefined properties to "Process" instead of
"Report", you won't encounter those warnings, and you'll get the (limited)
support that the UML2 code generator provides for redefined properties.

Kenn

"Szymon " <szymekf@hotmail.com> wrote in message
news:607f76dabb58577be18551411e1d55a0$1@www.eclipse.org...
> Hi,
>
> I am using uml2 and I have a problem with assigning a default value to an
> inherited property.
>
> In my uml model I have a class A with a property a. In a class B, which is
> a child of A I would like to assign a default value for the property a. In
> class B I use the same name for the property a.
> When I try to generate the EMF model I get a warning "Discarded feature
> 'B::a' because it is a duplicate of inherited feature 'A::a'". If I set
> the "Redefined Property" of B::a to point to A::a it is even worse
> because I get an additional warning: "Feature 'B::a' should be annotated
> as redefintion of feature 'A::a'".
> Obviously when I generate a java code on the basis of my model the default
> value is not assigned to the property a of class B.
>
> Any idea how I could assign a default value to the property a of the class
> B?
>
> regards,
> Szymon
>
Re: assigning a default value to an inherited property [message #478491 is a reply to message #478473] Thu, 04 June 2009 08:53 Go to previous messageGo to next message
Szymon is currently offline Szymon
Messages: 6
Registered: July 2009
Junior Member
Hi Kenn,

Thank you for the answer. I tried this and Eclipse generated java code.
However, the default value is not assigned in the inherited property. Is
this correct?

regards,
Szymon
Re: assigning a default value to an inherited property [message #478507 is a reply to message #478491] Tue, 09 June 2009 15:47 Go to previous message
Kenn Hussey is currently offline Kenn Hussey
Messages: 1618
Registered: July 2009
Senior Member
Szymon,

I can't recall off-hand whether the templates support re-initializing the
field to a different default, but if they don't, I don't see why they
couldn't. If you open a Bugzilla request, we'll look into it.

Kenn

"Szymon " <szymekf@hotmail.com> wrote in message
news:e2791546c2863097b8d15421e58dea6c$1@www.eclipse.org...
> Hi Kenn,
>
> Thank you for the answer. I tried this and Eclipse generated java code.
> However, the default value is not assigned in the inherited property. Is
> this correct?
>
> regards,
> Szymon
>
Re: assigning a default value to an inherited property [message #627648 is a reply to message #478439] Thu, 28 May 2009 19:20 Go to previous message
Kenn Hussey is currently offline Kenn Hussey
Messages: 1618
Registered: July 2009
Senior Member
Szymon,

If you set the option for redefined properties to "Process" instead of
"Report", you won't encounter those warnings, and you'll get the (limited)
support that the UML2 code generator provides for redefined properties.

Kenn

"Szymon " <szymekf@hotmail.com> wrote in message
news:607f76dabb58577be18551411e1d55a0$1@www.eclipse.org...
> Hi,
>
> I am using uml2 and I have a problem with assigning a default value to an
> inherited property.
>
> In my uml model I have a class A with a property a. In a class B, which is
> a child of A I would like to assign a default value for the property a. In
> class B I use the same name for the property a.
> When I try to generate the EMF model I get a warning "Discarded feature
> 'B::a' because it is a duplicate of inherited feature 'A::a'". If I set
> the "Redefined Property" of B::a to point to A::a it is even worse
> because I get an additional warning: "Feature 'B::a' should be annotated
> as redefintion of feature 'A::a'".
> Obviously when I generate a java code on the basis of my model the default
> value is not assigned to the property a of class B.
>
> Any idea how I could assign a default value to the property a of the class
> B?
>
> regards,
> Szymon
>
Re: assigning a default value to an inherited property [message #627669 is a reply to message #478473] Thu, 04 June 2009 08:53 Go to previous message
Szymon is currently offline Szymon
Messages: 6
Registered: July 2009
Junior Member
Hi Kenn,

Thank you for the answer. I tried this and Eclipse generated java code.
However, the default value is not assigned in the inherited property. Is
this correct?

regards,
Szymon
Re: assigning a default value to an inherited property [message #627684 is a reply to message #478491] Tue, 09 June 2009 15:47 Go to previous message
Kenn Hussey is currently offline Kenn Hussey
Messages: 1618
Registered: July 2009
Senior Member
Szymon,

I can't recall off-hand whether the templates support re-initializing the
field to a different default, but if they don't, I don't see why they
couldn't. If you open a Bugzilla request, we'll look into it.

Kenn

"Szymon " <szymekf@hotmail.com> wrote in message
news:e2791546c2863097b8d15421e58dea6c$1@www.eclipse.org...
> Hi Kenn,
>
> Thank you for the answer. I tried this and Eclipse generated java code.
> However, the default value is not assigned in the inherited property. Is
> this correct?
>
> regards,
> Szymon
>
Previous Topic:Duplicate XMI id
Next Topic:Flatten the packaging structure like in the UML2 metamodel
Goto Forum:
  


Current Time: Thu Oct 02 04:37:03 GMT 2014

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

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