I have a service using a method and I have actual method call also using it. can we differentiate between both in Aspect programming.
for eg.
public class AccountProcessorImpl implements AccountProcessor{
public Response calculateBalance(Account accountInfo){
//some implementaion
}
}
@Path("account")
public class AccountService{
@InjectParam
AccountProcessor accountProcessor;
public Response getBalance (Account accountInfo)
{
return accountProcessor.calculateBalance(accountInfo);
}
}
I have included the method calculateBalance in my Aspect program to do some authentication(PointCut()). Now I want to use this method just as a method call. Now the method fails due to the authentication. so Can I differentiate some how? like do authentication only if its a Rest API call and no need authentication if its a method call