Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Limiting depth of pointcut for subclasses

Take a look at:

<http://fisheye1.cenqua.com/browse/~raw,r=1.1/springframework/spring/aspectj/src/org/springframework/beans/factory/aspectj/AbstractDependencyInjectionAspect.aj>
and
<http://fisheye1.cenqua.com/browse/~raw,r=1.2/springframework/spring/aspectj/src/org/springframework/beans/factory/aspectj/AbstractInterfaceDrivenDependencyInjectionAspect.aj>

In particular, the leastSpecificSuperTypeConstruction() pointcut seems like what you need.

-Ramnivas

On Tue, Feb 5, 2008 at 8:25 AM, <hermod.opstvedt@xxxxxxxxx> wrote:
Hi

I was afraid there was no easy way - maybe we should ask for an
enhancement to add a new attribute that will limit a Object+ construct.

Hermod

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Gijs Peek
Sent: Tuesday, February 05, 2008 2:20 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Limiting depth of pointcut for subclasses


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Although I fail to comprehend why you would ever need this (maybe you
should consider modifying your design), my guess would be that you can
only achieve such an effect by using the if() pointcut and applying
reflection to determine the classes' location in the hierarchy (e.g., by
using the Class.getInterfaces method). Your pointcut then would probably
look something like pointcut pc(A obj):
   this(obj) &&
if(Arrays.asList(obj.getClass().getInterfaces()).contains(A.class)))

cheers,
 - Gijs Peek

hermod.opstvedt@xxxxxxxxx wrote:
> Limiting depth of pointcut for subclasses
>
> Hi
>
> Is there a short and easy way of shortening the depth of a pointcut?
> The scenario is that I advise the construction of objects that
> implement an interface. However I only want to advice the first child
> in the hierarchy of implementation. I.E Interface A extends interface
> I, Interface A1 extends interface A. Class C implements A and class C1

> implements A1. I only want to advice A (i.e construction of C). First
> challenge is that interface I is the only known interface at design
> time.
>
> Hermod
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> * * *
>
> This email with attachments is solely for the use of the individual or

> entity to whom it is addressed. Please also be aware that the DnB NOR
> Group cannot accept any payment orders or other legally binding
correspondence with
> customers as a part of an email.
>
> This email message has been virus checked by the anti virus programs
> used in the DnB NOR Group.
>
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> * * *
>
> ----------------------------------------------------------------------
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIVAwUBR6hil7b66fbjXztVAQJhLRAApdmbyeaDh42S4826qwA3cvvWzNqy53ua
xZsKM0b5qNGeUl4mjSBRO9cEJmbXk4Tf/JEQa6LO96RjUEAU9y/2oE66JAtMYAMv
CCbOM7vjhlPd2BgrSua/0SfEcGDh58kdiExXx3+5qtexd0FZAIJxrg3hWWkKsv7F
fJ6kO7jB02cnB60Qb4xfZGDclu3cC/2R7XyJyFE2tW4n6kGz27ONUDzj/yziTKS0
S1O0x+NgfwG9sL7h48FwghfgbjxgxTUQ9M8dqicvItLdylRoZAfLje1BPPCgRA4B
aGK+O8TRzSuvOtxHec3sYOfFJnKG/05c4yrjN95MSUYWhT/pMtBDv9wJtwya+tu9
kKS/As1ia9Lb+zcyxLoO3/hFJ1klmOGadWdLXSn9uoMfAYDflbyuzSgLQO8TbUr0
Y+BaH6e+vovRFb62nLwScVr2iw/xw8RMknjmEkonrEskcNKVRIdDV62whTKi5XeE
t2pp7wqBwoUFKfHSeNjEceX7kj2n2ifI7eF79n8T41lfcEvvrC5lQbWIyRyBTmDh
PkGl4bHtPPMdOQhJ1Mv4x1x0ptwMAVuC7CdpFgotnyxAaZSTUzVcxYAp8hWQ3mwB
9xlKl9V3LPdNZ9/7rjlo2nm8ZMLj8oJTvgQ2y48KgpiA903K18R9dnyejop/R83R
Ix+3jo78O5c=
=RCIp
-----END PGP SIGNATURE-----
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that the DnB NOR Group
cannot accept any payment orders or other legally binding correspondence with
customers as a part of an email.

This email message has been virus checked by the anti virus programs used
in the DnB NOR Group.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top