Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Adding an interace to class based on it implementing a interface.
Adding an interace to class based on it implementing a interface. [message #56321] Wed, 31 August 2005 18:04 Go to next message
Chris Rudd is currently offline Chris RuddFriend
Messages: 4
Registered: July 2009
Junior Member
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 #56346 is a reply to message #56321] Wed, 31 August 2005 18:58 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Adding an interace to class based on it implementing a interface. [message #56385 is a reply to message #56346] Thu, 01 September 2005 17:40 Go to previous message
Chris Rudd is currently offline Chris RuddFriend
Messages: 4
Registered: July 2009
Junior Member
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 18:58 Go to previous message
Adrian Colyer is currently offline Adrian ColyerFriend
Messages: 61
Registered: July 2009
Member
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 17:40 Go to previous message
Chris Rudd is currently offline Chris RuddFriend
Messages: 4
Registered: July 2009
Junior Member
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.
Previous Topic:ClassFormatError
Next Topic:AJDT New Feature of the Week: Navigation and source hovers for pointcuts
Goto Forum:
  


Current Time: Thu Apr 25 06:50:20 GMT 2024

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

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

Back to the top