public MethodJoinPointGenerator getJoinPointGenerator(MethodInfo info) { MethodJoinPointGenerator generator = (MethodJoinPointGenerator)joinPointGenerators.get(info.getJoinpoint()); if (generator == null) { generator = new MethodJoinPointGenerator(GeneratedClassAdvisor.this, info); initJoinPointGeneratorsMap(); MethodJoinPointGenerator existing = (MethodJoinPointGenerator)joinPointGenerators.putIfAbsent(info.getJoinpoint(), generator); if (existing != null) { generator = existing; } } return generator; }
/** * Creates a {@link AOPBasedContainerInvocation} * * @param method The AOP method * @param args The arguments to the method */ public AOPBasedContainerInvocation(MethodInfo aopMethodInfo, Object[] args) { this.aopMethodInfo = aopMethodInfo; this.args = args; // set the unadvised method this.unadvisedMethod = this.aopMethodInfo.getUnadvisedMethod(); }
public MethodInfo getMethodInfo(Method method) { MethodInfo info = new MethodInfo(); info.setAdvisor(getAdvisor()); info.setAdvisedMethod(method); info.setUnadvisedMethod(method); return info; }
public MethodInfo getMethodInfo(Advisor advisor) { MethodInfo info = new MethodInfo(clazz, advisedHash, unadvisedHash, advisor); info.setInterceptors(interceptors); return info; }
public MethodInvocation(MethodInfo info, org.jboss.aop.advice.Interceptor[] interceptors) { this(interceptors, info.getHash(), info.getMethod(), info.getUnadvisedMethod(), info.getAdvisor()); }
Method unadvisedMethod = methodInfo.getUnadvisedMethod(); Interceptor[] timeoutMethodAOPInterceptors = this.getInterceptors(methodInfo.getJoinpoint(),SINGLETON_BEAN_TIMEOUT_METHOD_AOP_INTERCEPTOR_STACK_NAME);
/** * If the target instance is advised, make sure that we set the unadvised method to the one stored by the class advisor * so that we don't get double invocations. */ @Override public MethodInfo getMethodInfo(long hash) { MethodInfo info = super.getMethodInfo(hash); if (classAdvisor instanceof ClassAdvisor && info.getMethod().equals(info.getUnadvisedMethod())) { MethodInfo superInfo = classAdvisor.getMethodInfo(hash); if (superInfo != null) { info.setUnadvisedMethod(superInfo.getUnadvisedMethod()); } } return info; }
public MethodJoinPointGenerator(GeneratedClassAdvisor advisor, MethodInfo info) { super(advisor, info, getParameters(info), info.getMethod().getParameterTypes().length, false); if (super.getJoinpointField() != null) { if (!info.getUnadvisedMethod().getReturnType().equals(Void.TYPE)) { returnType = new WeakReference<Class<?>>(info.getUnadvisedMethod().getReturnType()); } hasTargetObject = !Modifier.isStatic(info.getMethod().getModifiers()); } }
private String advisedMethodName(MethodInfo info) { return info.getMethod().getName(); }
private void populateInterceptors(MethodInfo info) Interceptor[] icptrs = info.getInterceptors(); if (icptrs != null) if (icptrs[i] instanceof PerInstanceInterceptor && !Modifier.isStatic(info.getMethod().getModifiers())) icptr = ((PerInstanceInterceptor)icptrs[i]).getAspectInstance(ia); else if (icptrs[i] instanceof PerJoinpointInterceptor && !Modifier.isStatic(info.getMethod().getModifiers())) if (icptrs[i] instanceof PerInstanceAdvice && !Modifier.isStatic(info.getMethod().getModifiers())) aspectInstance = ((PerInstanceAdvice)advice).getAspectInstance(ia); else if (icptrs[i] instanceof PerJoinpointAdvice && !Modifier.isStatic(info.getMethod().getModifiers()))
info = new MethodInfo(clazz, hash, hash, this); methodInfos.put(hash, info); aspects = info.getInterceptors(); if (aspects == null) aspects = new Interceptor[0]; if (target != null && target instanceof Advised)
/** * 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; }
public Interceptor[] getInterceptors() { if (this.overridenAOPInterceptors == null) { return this.aopMethodInfo.getInterceptors(); } return this.overridenAOPInterceptors; }
Interceptor[] oldInterceptorChain = this.methodInterceptors.get(newMethodInfo); if ((oldInterceptorChain == null || oldInterceptorChain.length == 0) && !newMethodInfo.getInterceptorChain().isEmpty()) else if ((oldInterceptorChain != null && oldInterceptorChain.length > 0) && newMethodInfo.getInterceptorChain().isEmpty()) this.methodInterceptors.put(methodInfo, methodInfo.getInterceptors());
public <T extends Annotation> T resolveAnnotation(Class<T> annotation) { T val = super.resolveAnnotation(annotation); if (val != null) { return val; } Advisor advisor = getAdvisor(); if (advisor != null) { return getAdvisor().resolveTypedAnnotation(hash, advisedMethod, annotation); } return null; } }
public JoinPointInfo copy() { return new MethodInfo(this); }
@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); } }
Method unadvisedMethod = info.getUnadvisedMethod(); Interceptor[] timeoutMethodAOPInterceptors = this.getInterceptors(info.getJoinpoint(),MDB_TIMEOUT_METHOD_AOP_INTERCEPTOR_STACK_NAME);
public MarshalledMethodInfo(MarshalledContainerProxy proxy, MethodInfo info) throws IOException { this.proxy = proxy; try { this.advisedHash = MethodHashing.methodHash(info.getMethod()); this.unadvisedHash = MethodHashing.methodHash(info.getUnadvisedMethod()); } catch (Exception e) { throw new MethodHashingException(e); } clazz = info.getMethod().getDeclaringClass(); populateInterceptors(info); }
private static JoinPointParameters getParameters(MethodInfo info) { if (Modifier.isStatic(info.getMethod().getModifiers())) { return JoinPointParameters.ONLY_ARGS; } return JoinPointParameters.TARGET_ARGS; }