private int getAspectDeclarationOrder(Advisor anAdvisor) { AspectJPrecedenceInformation precedenceInfo = AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor); if (precedenceInfo != null) { return precedenceInfo.getDeclarationOrder(); } else { return 0; } }
private void maybeBindThisJoinPointStaticPart() { if (this.argumentTypes[0] == JoinPoint.StaticPart.class) { bindParameterName(0, THIS_JOIN_POINT_STATIC_PART); } }
@Override public ContextBasedMatcher parse(String expression) { return new BeanContextMatcher(expression); } }
private Pointcut getPointcut(String expression) { AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); pointcut.setExpression(expression); return pointcut; }
private static boolean matches(final String beanName, String pcExpression) { @SuppressWarnings("serial") AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut() { @Override protected String getCurrentProxiedBeanName() { return beanName; } }; pointcut.setExpression(pcExpression); return pointcut.matches(TestBean.class); }
private Advisor createAspectJAdvice(int advisorOrder, int adviceDeclarationOrder, String aspectName, AbstractAspectJAdvice advice) { advice.setDeclarationOrder(adviceDeclarationOrder); advice.setAspectName(aspectName); AspectJPointcutAdvisor advisor = new AspectJPointcutAdvisor(advice); advisor.setOrder(advisorOrder); return advisor; }
/** * Return the name of the aspect (bean) in which the advice was declared. * @since 4.3.15 * @see AbstractAspectJAdvice#getAspectName() */ public String getAspectName() { return this.advice.getAspectName(); }
private int countNumberOfUnboundAnnotationArguments() { int count = 0; for (int i = 0; i < this.argumentTypes.length; i++) { if (isUnbound(i) && isSubtypeOf(Annotation.class, i)) { count++; } } return count; }
/** * If the test uses any of the this, target, at_this, at_target, and at_annotation vars, * then it tests subtype sensitive vars. */ public boolean testsSubtypeSensitiveVars() { return (this.runtimeTest != null && new SubtypeSensitiveVarTypeTestVisitor().testsSubtypeSensitiveVars(this.runtimeTest)); }
/** * Overridden in around advice to return proceeding join point. */ protected JoinPoint getJoinPoint() { return currentJoinPoint(); }
/** * Determine the order for this factory's aspect instance, * either an instance-specific order expressed through implementing * the {@link org.springframework.core.Ordered} interface, * or a fallback order. * @see org.springframework.core.Ordered * @see #getOrderForAspectClass */ @Override public int getOrder() { return getOrderForAspectClass(this.aspectClass); }
private RuntimeTestWalker getRuntimeTestWalker(ShadowMatch shadowMatch) { if (shadowMatch instanceof DefensiveShadowMatch) { return new RuntimeTestWalker(((DefensiveShadowMatch) shadowMatch).primary); } return new RuntimeTestWalker(shadowMatch); }
/** * Create a fully configured {@link TypePatternClassFilter} using the * given type pattern. * @param typePattern the type pattern that AspectJ weaver should parse */ public TypePatternClassFilter(String typePattern) { setTypePattern(typePattern); }
@Override public Signature getSignature() { if (this.signature == null) { this.signature = new MethodSignatureImpl(); } return this.signature; }
/** * Return the ProceedingJoinPoint for the current invocation, * instantiating it lazily if it hasn't been bound to the thread already. * @param rmi the current Spring AOP ReflectiveMethodInvocation, * which we'll use for attribute binding * @return the ProceedingJoinPoint to make available to advice methods */ protected ProceedingJoinPoint lazyGetProceedingJoinPoint(ProxyMethodInvocation rmi) { return new MethodInvocationProceedingJoinPoint(rmi); }
public void oneTestBeanArg(TestBean bean) { getCollaborator().oneTestBeanArg(bean); }
public void testBeanArrayArg(ITestBean[] beans) { getCollaborator().testBeanArrayArg(beans); }
public void objectMatchNoArgs() { getCollaborator().objectMatchNoArgs(); }
@Log public static class TestServiceImpl implements TestService { @Override public String sayHello() { throw new TestException("TestServiceImpl"); } }
@Override @TestAnnotation public void doIt() { } }