Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Accessing the Method object within a pointcut...

You should also check out the "Worker Object Creation Pattern" from Ramnivas
Laddad's AspectJ In Action.

Here's the essence

Runnable capturedJoinPoint = new Runnable(){

public void run(){
    proceed()
}
};

--Nick

-- 
Nicholas Lesiecki
Software Craftsman, specializing in J2EE,
Agile Methods, and aspect-oriented programming

Check out my books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt

Check out my articles on AspectJ:
* http://tinyurl.com/66vu and http://tinyurl.com/66vv

On 2/5/04 4:57 PM, "Wes Isberg" <wes@xxxxxxxxxxxxxx> wrote:

> It's not a keyword; it's part of the runtime reflective
> access to the join point, which can mostly only be found
> in the API docs :)
> 
> To get the parameter types in advice on the method-execution:
> 
>  CodeSignature code = (CodeSignature)
>               thisJoinPointStaticPart.getSignature();
>  // save this
>  // later:  code.getParameterTypes();
> 
> Wes
> 
> Alan Brown wrote:
> 
>> I have a pointcut that matches the methods of my public API.  When it is
>> triggered I wish to save the method object that is being called so I can
>> use reflection to invoke it later.  My problem is that my current way of
>> doing this is to grab the method name and the args and then reconstitute
>> the method later.  However, this falls down when the method is passed
>> 'null' as an argument.
>> 
>> There must be a simple way of accessing the actual method object that
>> has been joined upon.  I have a workaround currently but it is ugly
>> beyond description and I can't believe it has to be that way.
>> 
>> I'm sure I must be missing a relevant key word that has been beyond my
>> research, and I'd appreciate a pointer toward it.
>> 
>> alan
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>> 
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users





Back to the top