Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Reg:AspectJ Advice specification

Hi,
     Is there is a possiblity return a value in Advice-"before". If possible please help me.

My code snippet:(JAVA)
public class ServiceSelection
{
    public String invokeService(String servicetype) throws AxisFault    
    {
           if(servicetype.equals("A"))
                  return "A";
           else if(servicetype.equals("B"))
                   return "B";
           else
                  return "C";
     }
}

Aspect

pointcut beforeaspect(String servicetype):execution(* *.ServiceSelection(String)) && args(servicetype);

    beforeString servicetype():beforeaspect(servicetype)
   {
            return "A";
    }


Based on the return value of aspect the if-else comparison needs to be execute. Is it possible in aspectj..

That is before the exe of ServiceSelection() aspect needs to wriiteen a value.. Based on that value ServiceSelection() ll be execute.


Thanks,

Back to the top