Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] 3 PROBLEMS--how to get value of parameters of method captured, how to capture all methods,jars needed

> Hi
>
> I am new to aspectj and am stuck. I face 3 problems....
>
> My aspect is written below :
>
>
> import java.io.BufferedWriter;
> import java.io.FileWriter;
> import java.io.IOException;
>
> public aspect aspectSOAP {
>
>             pointcut entry(): call (* *(*))||call(* *(*,*));
>                   //    I NEED TO CAPTURE ALL METHOD THAT ARE INVOKED
>
>             before(): entry(){
>
>                   try{
>
>                   BufferedWriter bw = new BufferedWriter (new
> FileWriter("C:\\Documents and
> Settings\\Administrator\\Desktop\\TextFromAspects\\First.txt",true));
>
>                   bw.write("Before entering
> method..."+thisJoinPoint.toString() );
>                   bw.newLine();
>                   bw.flush();
>                   bw.close();
>
>                   }
>                   catch(IOException ee)
>                   {
>                         System.err.println("ERROR");
>                   }
>                   }
>
>
>             after(): entry(){
>
>                   try{
>                   BufferedWriter bw = new BufferedWriter (new
> FileWriter("C:\\Documents and
> Settings\\Administrator\\Desktop\\TextFromAspects\\First.txt",true));
>
>                   bw.write("After entering
> method..."+thisJoinPoint.toString());
>                   bw.newLine();
>                   bw.newLine();
>                   bw.flush();
>                   bw.close();
>                   }
>                   catch(IOException ee)
>                   {}
>                   }
>             }
> 1) HOW DO I GET THE VALUE OF THE PARAMETERS/ARGUMENTS OF THE METHODS
> CAPTURED ?
>
>             I tried doing it thisJoinPoint.getArgs() but this gave me
> something else
>
> 2)IF I WANT TO CAPTURE ALL THE METHODS THAT ARE CALLED WHAT POINT CUT
> SHOULD I USE? THE ONE I HAVE USED ABOVE ASSUMES THAT THERE ARE 1 OR 2
> ARGUMENTS BUT THAT MAY NOT BE TRUE! SO HOW SO I CAPTURE ALL CALLS
> IRRESPECTIVE OF NO. OF PARAMETERS.
>
> 3)WHICH  JARS CONTAIN THE DEFINATION OF  thisJoinPoint ... APART FROM
> ASPECTJRT.JAR     ASPECTJLIB.JAR    ASPECTJTOOLS.JAR  ASPECTJWEAVER.JAR
>
>
> THANKS IN ADVANCE...
>
> REGARDS
>
> RAGHAV GOEL
>
>



Back to the top