Skip to main content

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

Hi,
    Thanks for your information. I used "around" instead of "before " to return a value. It works fine. Thank you.


On Fri, Feb 7, 2014 at 1:18 PM, Alexander Kriegisch <Alexander@xxxxxxxxxxxxxx> wrote:
No. Just use around() instead.

-- 
Alexander Kriegisch


Am 07.02.2014 um 02:52 schrieb Shanmuga Priya R <shanmugapriya1228@xxxxxxxxxxxxxx>:

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,
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top