[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Runtime architecture of the aspect code
|
Hi,
I have following aspect.
import java.util.HashMap;
aspect ReferenceValue {
private boolean LanguageGenerator.isReference = false;
private String LanguageGenerator.referenceValue;
private HashMap LanguageGenerator.referenceValueMap = new HashMap();
private String LanguageGenerator.getReferenceValue(String ntName){
referenceValueMap.put("ServiceReferenceList", "99912");
String value = (String)referenceValueMap.get(ntName);
return value;
}
pointcut nonterminalExpansion(String nonTerminalName):execution(* LanguageGenerator.expandNode(String, ..))&& args(nonTerminalName, ..);
pointcut getIdentifierValue():execution(String LanguageGenerator.getValue(String));
pointcut settingReference():set(String LanguageGenerator.referenceValue);
before(String ntName):nonterminalExpansion(ntName){
LanguageGenerator lg = (LanguageGenerator)thisJoinPoint.getThis();
lg.referenceValue = lg.getReferenceValue(ntName);
if(null != lg.referenceValue){
lg.isReference = true;
System.out.println(ntName + " is a reference nonterminal " + lg.referenceValue);
}
}
String around():getIdentifierValue(){
LanguageGenerator lg = (LanguageGenerator)thisJoinPoint.getThis();
Object []args = thisJoinPoint.getArgs();
System.out.println(args[0]);
Object value = proceed();
System.out.println("Getting value for identifier " + " and referenceValue is " + lg.referenceValue);
if(null != lg.referenceValue){
System.out.println("Value is not null " + lg.referenceValue);
value = lg.referenceValue;
lg.referenceValue = null;
}
return (String)value;
}
}
And I DONT SEE the STATE OF langaugeGenerator is maintained in between two advice calls. i.e. the referenceValue set is getting lost.
Whats going on here?
Thanks a lot,
Unmesh
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable.
Sign up now