Adding an interace to class based on it implementing a interface. [message #56321] |
Wed, 31 August 2005 14:04  |
Eclipse User |
|
|
|
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.
|
|
|
|
Re: Adding an interace to class based on it implementing a interface. [message #56385 is a reply to message #56346] |
Thu, 01 September 2005 13:40  |
Eclipse User |
|
|
|
Yup. Figured that out late last night. Thx for the reply.
"Adrian Colyer" <adrian_colyer@uk.ibm.com> wrote in message
news:df4uk0$tut$1@news.eclipse.org...
> 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.
|
|
|
Re: Adding an interace to class based on it implementing a interface. [message #589969 is a reply to message #56321] |
Wed, 31 August 2005 14:58  |
Eclipse User |
|
|
|
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.
|
|
|
Re: Adding an interace to class based on it implementing a interface. [message #589982 is a reply to message #56346] |
Thu, 01 September 2005 13:40  |
Eclipse User |
|
|
|
Yup. Figured that out late last night. Thx for the reply.
"Adrian Colyer" <adrian_colyer@uk.ibm.com> wrote in message
news:df4uk0$tut$1@news.eclipse.org...
> 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.04097 seconds