[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-dev] Getting a local variable from the caller to the advice
|
I have the following scenario:
public class MyCommand {
public void execute(Map cachmanager) {
System.out.println("I am in MyCommand: Before Service Call");
ServiceUtil.getService
("MyService");
System.out.println("I am in MyCommand: After Service Call");
}
public class ServiceUtil {
public static String getService(String serviceName){
String serviceObject = "Static Service";
System.out.println("Service invoked is : "+ serviceName);
return serviceObject;
}
}
I want to add Preprocessing beforethe Service Call.
public aspect ServiceUtilAspect {
pointcut callServiceUtil():
call (public static String ServiceUtil.getService(String));
before() :callServiceUtil()
{
Class Command = thisJoinPoint.getSourceLocation
().getWithinType();
IPreProcessor preprocessor = (IPreProcessor)PrePostProcessorResolver.getPreProcessor(Command);
//Map cachmanager = new HashMap();
preprocessor.preprocess(
cachmanager);
}
}
I want to be get the cachmanager from the Command. Is it possible using Aspectj? Can anyone help?