public MethodInfo getMethodInfo(long hash) { MethodMatchInfo info = getMatchInfo(hash); if (info != null) { return info.getInfo(); } return null; }
protected void finalizeMethodChain() { boolean maintain = AspectManager.maintainAdvisorMethodInterceptors; TLongObjectHashMap newMethodInfos = (maintain) ? new TLongObjectHashMap() : null; long[] keys = methodInfos.keys(); for (int i = 0; i < keys.length; i++) { MethodMatchInfo matchInfo = methodInfos.getMatchInfo(keys[i]); matchInfo.populateBindings(); MethodInfo info = matchInfo.getInfo(); adjustInfoForAddedBinding(info); ArrayList<Interceptor> list = info.getInterceptorChain(); Interceptor[] interceptors = null; if (list.size() > 0) { interceptors = applyPrecedence(list.toArray(new Interceptor[list.size()])); } info.setInterceptors(interceptors); if (maintain) { newMethodInfos.put(keys[i], info); } } methodInterceptors = newMethodInfos; }
MethodMatchInfo info = methodInfos.getMatchInfo(keys[i]); info.addMatchedBinding(binding, match); if (AspectManager.maintainAdvisorMethodInterceptors)
protected void updateMethodPointcutAfterRemove(AdviceBinding binding) { long[] keys = methodInfos.keys(); for(int i =0; i < keys.length; i++) { Method method = (Method) advisedMethods.get(keys[i]); PointcutMethodMatch match = binding.getPointcut().matchesExecution(this, method); if (match != null && match.isMatch()) { if (AspectManager.verbose) { logger.debug("removing matched binding: "+method.toString()); } MethodMatchInfo info = methodInfos.getMatchInfo(keys[i]); info.removeMatchedBinding(binding, match); info.getInfo().clear(); if (AspectManager.maintainAdvisorMethodInterceptors) { methodInterceptors.put(keys[i], info); } } } }
private void easyFinalizeMethodChainForInstance(ClassAdvisor classAdvisor, MethodInterceptors newMethodInterceptors) { long[] keys = newMethodInterceptors.keys(); for (int i = 0; i < keys.length; i++) { MethodInfo classMethodInfo = classAdvisor.getMethodInfo(keys[i]); MethodMatchInfo matchInfo = newMethodInterceptors.getMatchInfo(keys[i]); MethodInfo myMethodInfo = matchInfo.getInfo(); myMethodInfo.cloneChains(classMethodInfo); if (updateOldInfo(oldInfos, myMethodInfo, OldInfoMaps.INFOS)) { MethodJoinPointGenerator generator = getJoinPointGenerator(myMethodInfo); generator.rebindJoinpoint(myMethodInfo); } } }
private void fullWorkFinalizeMethodChain(MethodInterceptors newMethodInterceptors) { //We are either the class advisor or an instanceadvisor with own data so we need to do all the work TLongObjectHashMap newMethodInfos = new TLongObjectHashMap(); long[] keys = newMethodInterceptors.keys(); for (int i = 0; i < keys.length; i++) { MethodMatchInfo matchInfo = newMethodInterceptors.getMatchInfo(keys[i]); matchInfo.populateBindings(); MethodInfo info = matchInfo.getInfo(); newMethodInfos.put(keys[i], info); MethodJoinPointGenerator generator = getJoinPointGenerator(info); finalizeChainAndRebindJoinPoint(oldInfos, info, generator, OldInfoMaps.INFOS); } if (AspectManager.maintainAdvisorMethodInterceptors) { methodInterceptors = newMethodInfos; } //Handle the overridden methods if (overriddenMethods != null && overriddenMethods.size() > 0) { for (MethodInfo info : overriddenMethods) { MethodJoinPointGenerator generator = getJoinPointGenerator(info); finalizeChainAndRebindJoinPoint(oldInfos, info, generator, OldInfoMaps.INFOS); } } }
@Override protected void initializeMethodChain() { //We have all the advised methods here, need to get all the others here too long[] keys = advisedMethods.keys(); for (int i = 0; i < keys.length; i++) { MethodMatchInfo matchInfo = methodInfos.getMatchInfo(keys[i]); if (super.initialized && matchInfo != null) { matchInfo.clear(); } if (matchInfo == null) { MethodInfo info = new MethodInfo(); Method amethod = (Method) advisedMethods.get(keys[i]); info.setAdvisedMethod(amethod); info.setUnadvisedMethod(amethod); info.setHash(keys[i]); info.setAdvisor(this); methodInfos.put(keys[i], info); } } }