|
Re: Adding an interace to class based on it implementing a interface. [message #56346 is a reply to message #56321] |
Wed, 31 August 2005 18:58 |
Eclipse User |
|
|
|
Originally posted by: adrian_colyer.uk.ibm.com
Chris Rudd wrote:
> Is it possibly to create a static crosscut that says "any class implementing
> interface X, implements interace Y as well".
>
> class Foo implements X
> {
> }
>
> public aspect ImplementY {
> declare parents : X extends Y;
> };
>
> The above changes X to implement Y, when I only want Foo to implement Y.
> Using implements instaed of extends makes no different either.
>
>
>
>
>
Yes, the trick is to write a type pattern that matches subtypes
(implementors) of X, but not X itself.
declare parents: (X+ && !X) implements Y;
should do the trick.
Regards, Adrian.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03713 seconds