I have a simple Main class like this.
class Main{
public static void main(String args[]){
String str = "Hello World!!";
<some function with argument as str>
}
}
Now I want to create an aspect which will crop this string or append anything into this string and to send the changed string into the function.And do something with the rest of the string.So,
1) Is it possible to do it using aspectJ LTW in java.
2) If yes,Please give me开发者_开发百科 an insight on how to do this.
Thanks in advance.
You could use something like this:
public aspect MyAppend {
around(String str) : call (* someFunction(String)) && args(str) {
proceed(str + " My appended string");
}
}
you can use Spring AOP
精彩评论