Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Redefined property type in Genmodel
Redefined property type in Genmodel [message #478149] Mon, 02 February 2009 17:00 Go to next message
Rimvydas is currently offline RimvydasFriend
Messages: 47
Registered: July 2009
Member
I have UML model with classes A, B, C and D. B extends A and D extends C.
Class A has a property "x" of type C. Class B has a property "x" of type D
and this property redefines property "x" in class A. After creating a
genmodel from the uml model in the ecore file I see that the class B has
annotation "duplicates" and property "x" inside it BUT the type of the
property is C.

Why the redefined property type in genmodel was changed to the type from
which the property was redefined?
Re: Redefined property type in Genmodel [message #478169 is a reply to message #478149] Fri, 06 February 2009 03:56 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Rimvydas,

The code generated from what you describe would produce A::getX() and
B::getX() impl's. The problem is that in Java, one cannot dis-inherit
properties/operations so the best outcome would be to produce one B::getX()
of the more general type C that overrides the getter from A.
I would recommend renaming the x from B to something else and then reloading
your genmodel. I believe that would reproduce what you may expect.

Cheers,
- James.

"Rimvydas " <rimvydas@nomagiclt.com> wrote in message
news:76cb60fdce2cbc2188815f11a40097e6$1@www.eclipse.org...
>I have UML model with classes A, B, C and D. B extends A and D extends C.
> Class A has a property "x" of type C. Class B has a property "x" of type D
> and this property redefines property "x" in class A. After creating a
> genmodel from the uml model in the ecore file I see that the class B has
> annotation "duplicates" and property "x" inside it BUT the type of the
> property is C.
>
> Why the redefined property type in genmodel was changed to the type from
> which the property was redefined?
>
Re: Redefined property type in Genmodel [message #478170 is a reply to message #478169] Fri, 06 February 2009 08:29 Go to previous messageGo to next message
Rimvydas is currently offline RimvydasFriend
Messages: 47
Registered: July 2009
Member
Hi James,

Thanks for your answer.
The property x in class B appears in 'duplicates' annotation. So As I
understand the property will be ignored by the code generator.
Actually I would like to generate method B::getX() that returns type D
(this is legal starting from java 1.5).

The code generated from what you describe would produce A::getX() and
B::getX() impl's. The problem is that in Java, one cannot dis-inherit
properties/operations so the best outcome would be to produce one B::getX()
of the more general type C that overrides the getter from A.
I would recommend renaming the x from B to something else and then
reloading
your genmodel. I believe that would reproduce what you may expect.

Cheers,
- James.

"Rimvydas " <rimvydas@xxxxxxxx> wrote in message
news:76cb60fdce2cbc2188815f11a40097e6$1@xxxxxxxxe.org...

I have UML model with classes A, B, C and D. B extends A and D extends
C.
Class A has a property "x" of type C. Class B has a property "x" of
type D
and this property redefines property "x" in class A. After creating a
genmodel from the uml model in the ecore file I see that the class B
has
annotation "duplicates" and property "x" inside it BUT the type of the
property is C.

Why the redefined property type in genmodel was changed to the type
from
which the property was redefined?
Re: Redefined property type in Genmodel [message #478173 is a reply to message #478170] Fri, 06 February 2009 17:05 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Rimvydas,

The code generation is probably a result of the Java 1.4 days when those
co-variant returns were not allowed.

This is probably a worth while issue to investigate further, please raise a
bugzilla if this is a problem for you.
Even though we could produce an API with multiple getX(), setX() of
different types, would this result in a confusing API ?


Cheers,
- James.


"Rimvydas " <rimvydas@nomagiclt.com> wrote in message
news:b2d167e486e4ef6f1ef49501a0ed5087$1@www.eclipse.org...
> Hi James,
>
> Thanks for your answer.
> The property x in class B appears in 'duplicates' annotation. So As I
> understand the property will be ignored by the code generator. Actually I
> would like to generate method B::getX() that returns type D (this is legal
> starting from java 1.5).
>
> The code generated from what you describe would produce A::getX() and
> B::getX() impl's. The problem is that in Java, one cannot dis-inherit
> properties/operations so the best outcome would be to produce one
> B::getX()
> of the more general type C that overrides the getter from A.
> I would recommend renaming the x from B to something else and then
> reloading
> your genmodel. I believe that would reproduce what you may expect.
>
> Cheers,
> - James.
>
> "Rimvydas " <rimvydas@xxxxxxxx> wrote in message
> news:76cb60fdce2cbc2188815f11a40097e6$1@xxxxxxxxe.org...
>
> I have UML model with classes A, B, C and D. B extends A and D extends
> C.
> Class A has a property "x" of type C. Class B has a property "x" of
> type D
> and this property redefines property "x" in class A. After creating a
> genmodel from the uml model in the ecore file I see that the class B
> has
> annotation "duplicates" and property "x" inside it BUT the type of the
> property is C.
>
> Why the redefined property type in genmodel was changed to the type
> from
> which the property was redefined?
>
Re: Redefined property type in Genmodel [message #627369 is a reply to message #478149] Fri, 06 February 2009 03:56 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Rimvydas,

The code generated from what you describe would produce A::getX() and
B::getX() impl's. The problem is that in Java, one cannot dis-inherit
properties/operations so the best outcome would be to produce one B::getX()
of the more general type C that overrides the getter from A.
I would recommend renaming the x from B to something else and then reloading
your genmodel. I believe that would reproduce what you may expect.

Cheers,
- James.

"Rimvydas " <rimvydas@nomagiclt.com> wrote in message
news:76cb60fdce2cbc2188815f11a40097e6$1@www.eclipse.org...
>I have UML model with classes A, B, C and D. B extends A and D extends C.
> Class A has a property "x" of type C. Class B has a property "x" of type D
> and this property redefines property "x" in class A. After creating a
> genmodel from the uml model in the ecore file I see that the class B has
> annotation "duplicates" and property "x" inside it BUT the type of the
> property is C.
>
> Why the redefined property type in genmodel was changed to the type from
> which the property was redefined?
>
Re: Redefined property type in Genmodel [message #627370 is a reply to message #478169] Fri, 06 February 2009 08:29 Go to previous message
Rimvydas is currently offline RimvydasFriend
Messages: 47
Registered: July 2009
Member
Hi James,

Thanks for your answer.
The property x in class B appears in 'duplicates' annotation. So As I
understand the property will be ignored by the code generator.
Actually I would like to generate method B::getX() that returns type D
(this is legal starting from java 1.5).

The code generated from what you describe would produce A::getX() and
B::getX() impl's. The problem is that in Java, one cannot dis-inherit
properties/operations so the best outcome would be to produce one B::getX()
of the more general type C that overrides the getter from A.
I would recommend renaming the x from B to something else and then
reloading
your genmodel. I believe that would reproduce what you may expect.

Cheers,
- James.

"Rimvydas " <rimvydas@xxxxxxxx> wrote in message
news:76cb60fdce2cbc2188815f11a40097e6$1@xxxxxxxxe.org...

I have UML model with classes A, B, C and D. B extends A and D extends
C.
Class A has a property "x" of type C. Class B has a property "x" of
type D
and this property redefines property "x" in class A. After creating a
genmodel from the uml model in the ecore file I see that the class B
has
annotation "duplicates" and property "x" inside it BUT the type of the
property is C.

Why the redefined property type in genmodel was changed to the type
from
which the property was redefined?
Re: Redefined property type in Genmodel [message #627373 is a reply to message #478170] Fri, 06 February 2009 17:05 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Rimvydas,

The code generation is probably a result of the Java 1.4 days when those
co-variant returns were not allowed.

This is probably a worth while issue to investigate further, please raise a
bugzilla if this is a problem for you.
Even though we could produce an API with multiple getX(), setX() of
different types, would this result in a confusing API ?


Cheers,
- James.


"Rimvydas " <rimvydas@nomagiclt.com> wrote in message
news:b2d167e486e4ef6f1ef49501a0ed5087$1@www.eclipse.org...
> Hi James,
>
> Thanks for your answer.
> The property x in class B appears in 'duplicates' annotation. So As I
> understand the property will be ignored by the code generator. Actually I
> would like to generate method B::getX() that returns type D (this is legal
> starting from java 1.5).
>
> The code generated from what you describe would produce A::getX() and
> B::getX() impl's. The problem is that in Java, one cannot dis-inherit
> properties/operations so the best outcome would be to produce one
> B::getX()
> of the more general type C that overrides the getter from A.
> I would recommend renaming the x from B to something else and then
> reloading
> your genmodel. I believe that would reproduce what you may expect.
>
> Cheers,
> - James.
>
> "Rimvydas " <rimvydas@xxxxxxxx> wrote in message
> news:76cb60fdce2cbc2188815f11a40097e6$1@xxxxxxxxe.org...
>
> I have UML model with classes A, B, C and D. B extends A and D extends
> C.
> Class A has a property "x" of type C. Class B has a property "x" of
> type D
> and this property redefines property "x" in class A. After creating a
> genmodel from the uml model in the ecore file I see that the class B
> has
> annotation "duplicates" and property "x" inside it BUT the type of the
> property is C.
>
> Why the redefined property type in genmodel was changed to the type
> from
> which the property was redefined?
>
Previous Topic:API for manipulating UML Profiled
Next Topic:A Questino about Composition
Goto Forum:
  


Current Time: Thu Apr 25 22:56:27 GMT 2024

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

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

Back to the top