[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] Aspects, What happens at runtime?, Please HELP


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();
 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  the STATE OF langaugeGenerator IS NOT maintained in between two advice calls. i.e. the referenceValue set is getting lost.

Whats going on here?

Thanks a lot,


Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now