/** * To be called by initialiseInfosForInstance() in the generated instance advisors */ protected MethodInfo copyInfoFromClassAdvisor(MethodInfo info) { MethodInfo copy = (MethodInfo)info.copy(); copy.setAdvisor(this); addMethodInfo(copy); return copy; }
@SuppressWarnings("deprecation") public MethodInfo(Class<?> clazz, long hash, long unadvisedHash, Advisor advisor) { super(advisor, clazz); try { this.hash = hash; advisedMethod = MethodHashing.findMethodByHash(clazz, hash); unadvisedMethod = MethodHashing.findMethodByHash(clazz, unadvisedHash); this.setAdvisor(advisor); } catch (Exception e) { throw new RuntimeException(e); } }
public MethodInfo getMethodInfo(Method method) { MethodInfo info = new MethodInfo(); info.setAdvisor(getAdvisor()); info.setAdvisedMethod(method); info.setUnadvisedMethod(method); return info; }
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. } } }
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); } }
@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); } } }