TLongObjectHashMap calledMethods = calledClassesMap.get(method.getDeclaringClass().getName());
if (calledMethods != null)
{
long calledHash = MethodHashing.calculateHash(method);
//CallerMethodInfo info = (CallerMethodInfo) calledMethods.get(calledHash);
MethodByConInfo info = (MethodByConInfo) calledMethods.get(calledHash);
if (info != null && info.hasAdvices())
{
//return advisor.invokeConstructorCaller(index, targetObject, args, info);
return advisor.invokeConstructorCaller(info, inv.getCallingObject(), targetObject, args);
}
}
}
}
}
}
}
else if (invocation instanceof MethodCalledByMethodInvocation)
{
MethodCalledByMethodInvocation inv = (MethodCalledByMethodInvocation) invocation;
Method callingMethod = inv.getCallingMethod();
if (isAdvised(callingMethod.getDeclaringClass()))
{
ClassAdvisor advisor = AspectManager.instance().getAdvisor(callingMethod.getDeclaringClass());
if (advisor != null)
{
long callingMethodHash = MethodHashing.calculateHash(callingMethod);
long calledHash = MethodHashing.calculateHash(method);
@SuppressWarnings("unchecked")
HashMap calledClassesMap = (HashMap) advisor.getMethodCalledByMethodInterceptors().get(callingMethodHash);
if (calledClassesMap != null)
{
TLongObjectHashMap calledMethods = (TLongObjectHashMap) calledClassesMap.get(method.getDeclaringClass().getName());
if (calledMethods != null)
{
//CallerMethodInfo info = (CallerMethodInfo) calledMethods.get(calledHash);
MethodByMethodInfo info = (MethodByMethodInfo) calledMethods.get(calledHash);
if (info != null && info.hasAdvices())
{
//return advisor.invokeCaller(callingMethodHash, targetObject, args, info, inv.getCallingObject());
return advisor.invokeCaller(info, inv.getCallingObject(), targetObject, args);
}
}