Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] help regarding thisJoinPoint

Hi,
if I understand correctly, you need to know the class name and method
name of the method being matched.

Using thisJoinPoint you can access all these informations, in a more
formal way of parsing "toString".

See http://www.eclipse.org/aspectj/doc/released/runtime-api/org/aspectj/lang/JoinPoint.html
for Javadocs.

You can obtain the signature using :

Signature s = thisJoinPoint.getSignature();

To obtain the class, you can use :

Class c = s.getDeclaringType();


A Signature can refer to anything AspectJ is able to match (see its
subinterfaces). In you case I suppose your advice is matching a
method, so you can cast it to MethodSignature to access the
java.lang.reflect.Method :

Method m = ((MethodSignature)s).getMethod();


Having Class and Method, you can inspect them to obtain names and more
informations.

Simone

2012/2/17 pss <sankpiusham@xxxxxxxxx>:
> thisJoinPoint.toString() returns a value like this:
> void pack.class.fun(String, String)
>
> I want to extract only the 'class.fun' part of it. How can I do it?
>
> Thank you
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top