@Override public MethodInfo getMethodInfo(long hash) { MethodInfo info = (MethodInfo)methodInfos.get(hash); return info; }
public ClassMetadataField getField(long shaKey) { return (ClassMetadataField)this.hashFields.get(shaKey); }
public MethodMatchInfo getMatchInfo(long hash) { return (MethodMatchInfo)infos.get(hash); }
public ClassMetadataField getField(long shaKey) { return (ClassMetadataField)this.hashFields.get(shaKey); }
public ClassMetadataField getField(long shaKey) { return (ClassMetadataField) this.hashFields.get(shaKey); }
private MethodByMethodInfo getCallerMethodInfo(long callingMethodHash, String calledClass, long calledMethodHash) { //Called via resolveCallerMethodInfo, maps are initialised HashMap<String, TLongObjectHashMap> calledClasses = (HashMap<String, TLongObjectHashMap>) methodCalledByMethodInterceptors.get(callingMethodHash); TLongObjectHashMap calledMethods = calledClasses.get(calledClass); MethodByMethodInfo info = (MethodByMethodInfo) calledMethods.get(calledMethodHash); return info; }
private ConByMethodInfo getConCalledByMethod(long callingMethodHash, String calledClass, long calledConHash) { HashMap<String, TLongObjectHashMap> calledClasses = (HashMap<String, TLongObjectHashMap>) conCalledByMethodInterceptors.get(callingMethodHash); TLongObjectHashMap calledMethods = calledClasses.get(calledClass); ConByMethodInfo info = (ConByMethodInfo) calledMethods.get(calledConHash); return info; }
private ConByConInfo getConCalledByCon(int callingIndex, String calledClass, long calledConHash) { HashMap<String, TLongObjectHashMap> calledClasses = conCalledByConInterceptors[callingIndex]; TLongObjectHashMap calledMethods = calledClasses.get(calledClass); ConByConInfo info = (ConByConInfo) calledMethods.get(calledConHash); return info; }
private MethodByConInfo getConstructorCallerMethodInfo(int callingIndex, String calledClass, long calledMethodHash) { HashMap<String, TLongObjectHashMap> calledClasses = methodCalledByConInterceptors[callingIndex]; TLongObjectHashMap calledMethods = calledClasses.get(calledClass); MethodByConInfo info = (MethodByConInfo) calledMethods.get(calledMethodHash); return info; }
/** * Invokes target object without applying interceptors. */ public Object invokeWithoutAdvisement(Object target, long methodHash, Object[] arguments) throws Throwable { try { Method method = (Method) unadvisedMethods.get(methodHash); return method.invoke(target, arguments); } catch (InvocationTargetException e) { throw e.getTargetException(); } }
/** * Retrieves the value for <tt>key</tt> * * @param key an <code>Object</code> value * @return the value of <tt>key</tt> or null if no such mapping exists. */ public Object get(Object key) { return _map.get(unwrapKey(key)); }
private void initializeEmptyCallerChain(long callingMethodHash, String calledClass, long calledMethodHash) throws Exception { //Called via resolveCallerMethodInfo, maps are initialised HashMap<String, TLongObjectHashMap> callingMethod = (HashMap<String, TLongObjectHashMap>) methodCalledByMethodBindings.get(callingMethodHash); if (callingMethod == null) { callingMethod = new HashMap<String, TLongObjectHashMap>(); methodCalledByMethodBindings.put(callingMethodHash, callingMethod); } TLongObjectHashMap classMap = callingMethod.get(calledClass); if (classMap == null) { classMap = new TLongObjectHashMap(); callingMethod.put(calledClass, classMap); } ArrayList<AdviceBinding> bindings = (ArrayList<AdviceBinding>) classMap.get(calledMethodHash); if (bindings == null) { bindings = new ArrayList<AdviceBinding>(); classMap.put(calledMethodHash, bindings); } }
private void initializeConCalledByMethodEmptyChain(long callingMethodHash, String calledClass, long calledConHash) throws Exception { HashMap<String, TLongObjectHashMap> callingMethod = (HashMap<String, TLongObjectHashMap>) conCalledByMethodBindings.get(callingMethodHash); if (callingMethod == null) { callingMethod = new HashMap<String, TLongObjectHashMap>(); conCalledByMethodBindings.put(callingMethodHash, callingMethod); } TLongObjectHashMap classMap = callingMethod.get(calledClass); if (classMap == null) { classMap = new TLongObjectHashMap(); callingMethod.put(calledClass, classMap); } ArrayList<AdviceBinding> bindings = (ArrayList<AdviceBinding>) classMap.get(calledConHash); if (bindings == null) { bindings = new ArrayList<AdviceBinding>(); classMap.put(calledConHash, bindings); } }
private void initializeConCalledByConEmptyChain(int callingIndex, String calledClass, long calledConHash) throws Exception { HashMap<String, TLongObjectHashMap> callingCon = conCalledByConBindings[callingIndex]; if (callingCon == null) { callingCon = new HashMap<String, TLongObjectHashMap>(); conCalledByConBindings[callingIndex] = callingCon; } TLongObjectHashMap classMap = callingCon.get(calledClass); if (classMap == null) { classMap = new TLongObjectHashMap(); callingCon.put(calledClass, classMap); } ArrayList<AdviceBinding> bindings = (ArrayList<AdviceBinding>) classMap.get(calledConHash); if (bindings == null) { bindings = new ArrayList<AdviceBinding>(); classMap.put(calledConHash, bindings); } }
private void initializeEmptyConstructorCallerChain(int callingIndex, String calledClass, long calledMethodHash) throws Exception { HashMap<String, TLongObjectHashMap> callingCon = methodCalledByConBindings[callingIndex]; if (callingCon == null) { callingCon = new HashMap<String, TLongObjectHashMap>(); methodCalledByConBindings[callingIndex] = callingCon; } TLongObjectHashMap classMap = callingCon.get(calledClass); if (classMap == null) { classMap = new TLongObjectHashMap(); callingCon.put(calledClass, classMap); } ArrayList<AdviceBinding> bindings = (ArrayList<AdviceBinding>) classMap.get(calledMethodHash); if (bindings == null) { bindings = new ArrayList<AdviceBinding>(); classMap.put(calledMethodHash, bindings); } }
public final boolean execute(long key, Object value) { int index = _otherMap.index(key); if (index >= 0 && eq(value, _otherMap.get(key))) { return true; } return false; }
private ConByMethodInfo initializeConCalledByMethodInterceptorsMap(Method callingMethod, long callingMethodHash, String calledClass, long calledConHash, Constructor<?> calledCon) throws Exception { HashMap<String, TLongObjectHashMap> calledClassesMap = (HashMap<String, TLongObjectHashMap>) conCalledByMethodInterceptors.get(callingMethodHash); if (calledClassesMap == null) { calledClassesMap = new HashMap<String, TLongObjectHashMap>(); conCalledByMethodInterceptors.put(callingMethodHash, calledClassesMap); } TLongObjectHashMap calledMethodsMap = calledClassesMap.get(calledClass); if (calledMethodsMap == null) { calledMethodsMap = new TLongObjectHashMap(); calledClassesMap.put(calledClass, calledMethodsMap); } ConByMethodInfo info = createConByMethodInfo(calledClass, callingMethod, callingMethodHash, calledCon, calledConHash); calledMethodsMap.put(calledConHash, info); return info; }
private MethodByMethodInfo initializeCallerInterceptorsMap(long callingMethodHash, String calledClass, long calledMethodHash, Method callingMethod, Method calledMethod) throws Exception { //Called via resolveCallerMethodInfo, maps are initialised HashMap<String, TLongObjectHashMap> calledClassesMap = (HashMap<String, TLongObjectHashMap>) methodCalledByMethodInterceptors.get(callingMethodHash); if (calledClassesMap == null) { calledClassesMap = new HashMap<String, TLongObjectHashMap>(); methodCalledByMethodInterceptors.put(callingMethodHash, calledClassesMap); } TLongObjectHashMap calledMethodsMap = calledClassesMap.get(calledClass); if (calledMethodsMap == null) { calledMethodsMap = new TLongObjectHashMap(); calledClassesMap.put(calledClass, calledMethodsMap); } //The standard MethodCalledByXXXXInvocation class calls by reflection and needs access calledMethod.setAccessible(true); Class<?> calledClazz = getClassLoader().loadClass(calledClass); MethodByMethodInfo info = new MethodByMethodInfo(ClassAdvisor.this, calledClazz, calledMethod, callingMethod, callingMethodHash, calledMethodHash, null); calledMethodsMap.put(calledMethodHash, info); return info; }
public void rebuildCallerInterceptors() throws Exception { //No need to initialise map here if it is empty long[] callingKeys = methodCalledByMethodInterceptors.keys(); for (int i = 0; i < callingKeys.length; i++) { long callingHash = callingKeys[i]; HashMap<String, TLongObjectHashMap> calledClasses = (HashMap<String, TLongObjectHashMap>) methodCalledByMethodInterceptors.get(callingHash); for (Map.Entry<String, TLongObjectHashMap> entry : calledClasses.entrySet()) { String cname = entry.getKey(); TLongObjectHashMap calledMethods = entry.getValue(); long[] calledKeys = calledMethods.keys(); for (int j = 0; j < calledKeys.length; j++) { long calledHash = calledKeys[j]; ArrayList<AdviceBinding> bindings = getCallerBindings(callingHash, cname, calledHash); Method calling = MethodHashing.findMethodByHash(clazz, callingHash); bindCallerInterceptorChain(bindings, callingHash, cname, calledHash, calling); } } } }
protected void initializeMethodChain() { long[] keys = advisedMethods.keys(); for (int i = 0; i < keys.length; i++) { 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); } }