Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] target(object and al extending objects)

You're close:
pointcut findConstructors(SomeSuperClass superclass):
 	call(SomeSuperClass+.new(..)) && target(superclass);

Ron Bodkin
Chief Technology Officer
New Aspects of Security
m: (415) 509-2895

> ------------Original Message-------------
> From: MisterJ <misterj@xxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Fri, Sep-5-2003 6:15 AM
> Subject: [aspectj-users] target(object and al extending objects)
> 
> Hello,
> 
> I think my question is rather trivial, but after long hours of searching, 
> I still don't find how to solve my problem.
> 
> With a pointcut like
> 
> pointcut findConstructors(): call(SomeSuperClass+.new (..));
> 
> I can find all the calls to constructors from SomeSuperClass and all the 
> classes that extend SomeSuperClass.
> 
> With a pointcut like
> 
> pointcut findConstructors(MyClass obj): call (MyClass.new (..));
> 
> I can find all the calls to constructors from MyClass and I can do 
> something with the object obj in the advice that uses this pointcut.
> 
> My problem is how to combine those two things. I want a pointcut that 
> finds all calls to constructors in a superclass and al the classes that 
> extend that superclass PLUS in the advice (after advice) I would like to 
> have a reference to the object that was just constructed. I expect that I 
> will have to cast it to the correct subclass? But how can i reach that object?
> 
> I had something like this in mind, but that doesn't compile:
> 
> pointcut findConstructors(SomeSuperClass+ superclass):
> 	call(SomeSuperClass+.new(..)) && target(superclass);
> 
> thanks in advance,
> Jan
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 


Back to the top