Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [gef-dev] Make owner a template parameter of Fig

gef
Discussion topic

Back to topic list

Re: [gef-dev] Make owner a template parameter of Fig

Reply

Author penyaskito
Full name Christian López Espínola
Date 2008-11-30 05:54:19 PST
Message On Sun, Nov 30, 2008 at 2:32 PM, Bob Tarling <bob dot tarling at gmail dot com> wrote:
> At the moment the Fig "owner" is an Object to allow any application
> using GEF to set the owner with any model element of its own.
>
> The problem is that the application has to cast the return of getOwner()
>
> MyElement element = (MyElement) myFig.getOwner();
>
> Now that we're using generics we have the option to let the
> application create their Fig classes with a specific owner type
>
> public class Fig<E> {
>
> private transient E _owner;
>
> public Fig(int x, int y, int w, int h, Color lineColor, Color
> fillColor, E own);
>
> public E getOwner();
>
> public void setOwner(E own);
>
> }
>
> Its a shame that applications such as ArgoUML won't get any immediate
> benefit from this due to the fact that their elements are always
> Object. However I hope that's something that may eventually be
> resolved in ArgoUML and they can also take advantage of this.
>
> Is this the right way to go?

IMHO, yes, it is. This can help people in discovering bugs at compile
time instead of at runtime.


--
Cheers,

Christian López Espínola <penyaskito>

« Previous message in topic | 2 of 2 | Next message in topic »

Messages

Show all messages in topic

Make owner a template parameter of Fig bobtarling Bob Tarling 2008-11-30 05:32:29 PST
     Re: [gef-dev] Make owner a template parameter of Fig penyaskito Christian López Espínola 2008-11-30 05:54:19 PST
Messages per page: