Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] [ajdt-dev] Reflection Question

I think you mean how to get information using
thisjointpoint. There are various methods that you can
use to get the info like currently executing object,
target object, arguments, source location etc..

you can use these methods as:

public aspect Tracer1 {
      
pointcut publics(): execution(public void
Buffer.put(String));
 
before(): publics(){
        System.out.println("Before:" +
thisJoinPoint.toShortString());
}
      
after():publics(){
   System.out.println("After:" + 
thisJoinPoint.toLongString);
    Buffer buf=(Buffer)thisJointPoint.getThis());
   System.out.println(buf.get());//methods of Buffer
 }
      
}


There are many other methods too asociated with
thisjoinPoint. You can get more information in AspectJ
programming guide.

Hope this helps...
Swati

--- nizar kabbany <nkabbany@xxxxxxxxxxxx> wrote:

> so how can I use "Reflection" with "thisJoinPoint" .
> i.e. is it possible to use them together! I really
> don't know!
> Thanks
> 
> 
> 
>   ----- Original Message ----- 
>   From: Wes Isberg 
>   To: aspectj-users@xxxxxxxxxxx 
>   Sent: Friday, October 08, 2004 11:28 PM
>   Subject: Re: [aspectj-users] [ajdt-dev] Reflection
> Question
> 
> 
>   The syntax for an aspect declaration, like that of
> a class, is
> 
>     {modifiers} aspect {name} {per...}
> [extends|implements] { ...
> 
>   So try
> 
>     public aspect Tracer1 {
> 
>   See the AspectJ programming guide for more
> details.
> 
>   Wes  
> 
>     ------------Original Message------------
>     From: "nizar kabbany" <nkabbany@xxxxxxxxxxxx>
>     To: steve@xxxxxxxxxxxxxx
>     Cc: aspectj-users@xxxxxxxxxxx
>     Date: Fri, Oct-8-2004 7:50 PM
>     Subject: [aspectj-users] [ajdt-dev] Reflection
> Question
>     hi guys,
> 
>     Eclips 3.0 
>     JAspect 1.1.12
> 
>     I am getting a compiler error when I efine my
> aspect to have a "Reflection" inside it. 
>     Does anyone has any idea why thisis happening.
> If I remove th e"Reflection" word, it compiles
> fine!!!
>     Thanks
>     Nizar
> 
>     here is the simple code:
> 
>    
>
-------------------------------------------------------
>     public aspect Reflection Tracer1 {
>      
>      pointcut publics(): execution(public void
> Buffer.put(String));
> 
>      before(): publics(){
>       System.out.println("Before:" +thisJoinPoint);
>       }
>      
>     after():publics(){
>       System.out.println("After:" + thisJoinPoint);
>      }
>      
>     }
>    
-------------------------------------------------------



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com


Back to the top