private String advisedMethodName(MethodInfo info) { return info.getMethod().getName(); }
private static JoinPointParameters getParameters(MethodInfo info) { if (Modifier.isStatic(info.getMethod().getModifiers())) { return JoinPointParameters.ONLY_ARGS; } return JoinPointParameters.TARGET_ARGS; }
public void makeAccessibleMethod(MethodInfo mi) { //If we do dynamic invokes the method will need to be accessible via reflection if private/protected SecurityActions.setAccessible(mi.getMethod()); } }
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 getExceptionExpression(MethodInfo info) Method m = info.getMethod(); StringBuilder expr = new StringBuilder(); if (m == null)
private void applyBinding(ArrayList<AdviceBinding> applicableBindings, AdviceBinding binding) { applicableBindings.add(binding); binding.addAdvisor(advisor); advisor.pointcutResolved(info, binding, new MethodJoinpoint(info.getMethod())); }
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); }
public MethodInvocation(MethodInfo info, org.jboss.aop.advice.Interceptor[] interceptors) { this(interceptors, info.getHash(), info.getMethod(), info.getUnadvisedMethod(), info.getAdvisor()); }
public Object localInvoke(MethodInfo info, Object[] args) throws Throwable { if (info.getMethod().equals(getOnMessage())) { ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); pushEnc(); try { Message message = (Message)args[0]; MethodInvocation invocation = (MethodInvocation) ((ObjectMessage) message).getObject(); invocation.getMetaData().addMetaData(CONSUMER_MESSAGE, CONSUMER_MESSAGE, message, PayloadKey.TRANSIENT); return this.dynamicInvoke(invocation); } finally { Thread.currentThread().setContextClassLoader(oldLoader); popEnc(); } } else return super.localInvoke(info, args); }
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()))
protected void handleOverriddenMethods(AdviceBinding binding) { if (overriddenMethods != null && overriddenMethods.size() > 0) { for(MethodInfo info : overriddenMethods) { Method method = info.getMethod(); PointcutMethodMatch match = binding.getPointcut().matchesExecution(this, method); if (match != null && match.isMatch()) { adviceBindings.add(binding); if (AspectManager.verbose) { logger.error("method matched binding " + binding.getPointcut().getExpr() + " " + method.toString()); } binding.addAdvisor(this); pointcutResolved(info, binding, new MethodJoinpoint(method)); } } } }
/** * 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; }
Method method = methodInfo.getMethod(); AbstractClassPool classPool = (AbstractClassPool) clazz.getClassPool(); Class<?>[] parameterTypes = method.getParameterTypes();
private void overridePopulateBindings(ArrayList<AdviceBinding> applicableBindings) { if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug("populate bindings for " + info.getMethod() + " all bindings"); int size = bindings.size(); int minMatchLevel = 1000000; for (int i = 0 ; i < size ; i++) { AdviceBinding binding = bindings.get(i); PointcutMethodMatch match = pointcutMethodMatches.get(i); if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug(match.getMatchLevel() + " " + match.getMatchedClass().getName() + " " + binding.getPointcut().getExpr() + " : " + binding.getInterceptorFactories().length); if (minMatchLevel > match.getMatchLevel() && !match.isInstanceOf()) { minMatchLevel = match.getMatchLevel(); } } if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug("populate bindings for " + info.getMethod() + " actual bindings"); for (int i = 0 ; i < size ; i++) { AdviceBinding binding = bindings.get(i); PointcutMethodMatch match = pointcutMethodMatches.get(i); if (match.isInstanceOf() || match.getMatchLevel() == minMatchLevel) { if (AspectManager.verbose && logger.isDebugEnabled()) logger.debug(match.getMatchLevel() + " " + match.getMatchedClass().getName() + " " + binding.getPointcut().getExpr() + " : " + binding.getInterceptorFactories().length); applyBinding(applicableBindings, binding); } } }
Method method = methodInfo.getMethod(); AbstractClassPool classPool = (AbstractClassPool) clazz.getClassPool(); Class<?>[] parameterTypes = method.getParameterTypes();
Method unadvisedMethod = info.getMethod(); SerializableMethod unadvisedMethodSerializable = new SerializableMethod(unadvisedMethod);
if (method != null && methodCallers == null && (method.getInterceptors() == null || method.getInterceptors().length < 1)) continue; indenter(pw, indent); pw.println("<method signature=\"" + method.getMethod().toString() + "\">"); if (method != null)
Method unadvisedMethod = info.getMethod(); SerializableMethod unadvisedMethodSerializable = new SerializableMethod(unadvisedMethod);