Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ Refactoring APIs

Hi,
I am trying to understand APIs in AJDT code to create AspectJ code programmatically. I have looked at these bugs: 111317, 110465, 88861. However, I still have a lot of questions. I will really appreciate if someone can help me.
 
1) First of all, bug 110465 mentions tests in org.aspectj.ajdt.core in class ASTVisitorTest. I am unable to locate this test class in the above package. I checked the project: org.aspectj.ajde, but I cannot find this class.
 
2) I was looking at the class AjASTRewriteAnalyzer. This class only has public "visit" APIs and I am not too sure how can I use these to create AspectJ code. Unlike the jdt OldASTRewrite it does not have APIs like markAsInserted etc.
 
3) I looked at the example given in bug: 88861. The example takes a string representing an aspect and creates a compilation unit from it.
 
I am thinking that is that the best way to create my aspects, i.e. I should put everything (all pointcuts/advices) in a string format and then call the AjNaiveASTFlattener.visit?
 
Even in this case, I created the string:
 
String source = "public aspect X {" +
    "pointcut p(): call(* *(..));" +
    "before():p() { c();}" +    
    "}";
and passed it on, but the print out is only:
 
public aspect X {
 pointcut p():call(* *(..));
 p{
  c();
 }
}
It did not print the advice signature at all.
 
>> Basically, I would like to create different kinds of pointcuts, create advice signatures, and also be able to create advice code from Java code (e.g. replace this.x by c.x). I am confused as to how do I do this? Should I put together everything in a String format and then just create a compilation Unit with this source?
 
I will really appreciate your response.
 


Thanks a lot,
Sincerely,
Irum Godil.
 


Yahoo! FareChase - Search multiple travel sites in one click.

Back to the top