public long[] keys() { return infos.keys (); }
public void rebuildCallerInterceptors() throws Exception { long[] callingKeys = conCalledByMethodInterceptors.keys(); for (int i = 0; i < callingKeys.length; i++) { long callingHash = callingKeys[i]; HashMap<String, TLongObjectHashMap> calledClasses = (HashMap<String, TLongObjectHashMap>) conCalledByMethodInterceptors.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 = getConCalledByMethodBindings(callingHash, cname, calledHash); bindConCalledByMethodInterceptorChain(bindings, callingHash, cname, calledHash); } } } }
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); } } } }
public boolean hasSameMethodAspectLength(Advisor other) { if (this.getClazz() != other.getClazz()) { throw new IllegalArgumentException("The advisors must be of the same type. Mine: " + this.getClazz().getName() + "; other: " + other.getClazz().getName()); } long[] myKeys = this.methodInfos.infos.keys(); long[] otherKeys = other.methodInfos.keys(); return JoinPointComparator.hasSameMethodAspectLength(myKeys, otherKeys, this, other); }
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); Method umethod = (Method) unadvisedMethods.get(keys[i]); if (umethod == null) umethod = amethod; info.setUnadvisedMethod(umethod); info.setHash(keys[i]); info.setAdvisor(this); methodInfos.put(keys[i], info); try { Field infoField = clazz.getDeclaredField(MethodExecutionTransformer.getMethodInfoFieldName(amethod.getName(), keys[i])); infoField.setAccessible(true); infoField.set(null, new WeakReference<MethodInfo>(info)); } catch (NoSuchFieldException e) { // ignore, method may not be advised. } catch (IllegalAccessException e) { throw new RuntimeException(e); //To change body of catch statement use Options | File Templates. } } }
/** * Create a HashMap of method hash and Method * Superclasses get added first so subclasses will override with * correct overriden method */ private void populateMethodTables(Class<?> superclass) throws Exception { if (superclass == null) return; if (superclass.equals(Object.class)) return; populateMethodTables(superclass.getSuperclass()); //The advisor for the superclass may be a container Advisor superAdvisor = manager.getAnyAdvisorIfAdvised(superclass); if (superAdvisor != null && superAdvisor instanceof ClassAdvisor) { TLongObjectHashMap superHash = ((ClassAdvisor)superAdvisor).getUnadvisedMethods(); long[] keys = superHash.keys(); for (int i = 0; i < keys.length; i++) { unadvisedMethods.put(keys[i], superHash.get(keys[i])); } } addDeclaredMethods(superclass); }
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); } }
pw.println("<methods>"); indent++; long[] keys = advisor.getMethodInterceptors().keys(); for (int i = 0; i < keys.length; i++)
@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); } } }