Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] the use of inter-type declaration for extendi ng a class

(I am quoting Ramnivas Laddad, if you don't have a copy of AspectJ in Action, run out and get one!)
"A crosscutting concern often needs to affect a set of classes or interfaces that share a common base type". (Graphics objects like pointers and menus in Swing come to mind). We can't go and change the class definition for Menu to inherit from mySpecialComponent instead of inheriting from Component. Even if you are working with a set of classes that you control, the whole point of the aspect is to separate concerns, not to hard-code them into your classes. So you create mySpecialComponent extends Component, and then define an aspect to insert the cross-cutting concern into the appropriate children of Component. "The result of such an arrangement is the decoupling of the aspect from the application-specific class, thus making the aspect more re-usable."
Hope this helps
Elizabeth
-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx]On Behalf Of Tra My
Sent: December 7, 2005 10:55 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] the use of inter-type declaration for extending a class

Hello,
 
As I know, in AspectJ there's a declaration like below, with A and B are classes
    declare parents: A extends B;
 
My question is: is there any real use of this kind of declaration? I think to change A's parent, we have an easier choice: change directly in class A's definition. Is there any reason why we should use this AspectJ declaration ? I hope the AspectJ authors have a reason to think of this declaration.
 
A small example would be very good.
 
I desperately need the answer for this question, any help would be greatly appreciated.
 
Regards,
 



CONFIDENTIAL AND PRIVILEGED INFORMATION NOTICE

This e-mail, and any attachments, may contain information that
is confidential, subject to copyright, or exempt from disclosure.
Any unauthorized review, disclosure, retransmission, 
dissemination or other use of or reliance on this information 
may be unlawful and is strictly prohibited.  

AVIS D'INFORMATION CONFIDENTIELLE ET PRIVILEGIEE

Le present courriel, et toute piece jointe, peut contenir de 
l'information qui est confidentielle, regie par les droits 
d'auteur, ou interdite de divulgation. Tout examen, 
divulgation, retransmission, diffusion ou autres utilisations 
non autorisees de l'information ou dependance non autorisee 
envers celle-ci peut etre illegale et est strictement interdite.

Back to the top