/** * Apply an intersection with the given MethodMatcher. * @param other the MethodMatcher to apply an intersection with * @return this composable pointcut (for call chaining) */ public ComposablePointcut intersection(MethodMatcher other) { this.methodMatcher = MethodMatchers.intersection(this.methodMatcher, other); return this; }
/** * Apply an intersection with the given Pointcut. * @param other the Pointcut to apply an intersection with * @return this composable pointcut (for call chaining) */ public ComposablePointcut intersection(Pointcut other) { this.classFilter = ClassFilters.intersection(this.classFilter, other.getClassFilter()); this.methodMatcher = MethodMatchers.intersection(this.methodMatcher, other.getMethodMatcher()); return this; }
/** * Build a 'safe' pointcut that excludes the AspectJ advice method itself. * @return a composable pointcut that builds on the original AspectJ expression pointcut * @see #getPointcut() */ public final Pointcut buildSafePointcut() { Pointcut pc = getPointcut(); MethodMatcher safeMethodMatcher = MethodMatchers.intersection( new AdviceExcludingMethodMatcher(this.aspectJAdviceMethod), pc.getMethodMatcher()); return new ComposablePointcut(pc.getClassFilter(), safeMethodMatcher); }
@Test public void testDynamicAndStaticMethodMatcherIntersection() throws Exception { MethodMatcher mm1 = MethodMatcher.TRUE; MethodMatcher mm2 = new TestDynamicMethodMatcherWhichMatches(); MethodMatcher intersection = MethodMatchers.intersection(mm1, mm2); assertTrue("Intersection is a dynamic matcher", intersection.isRuntime()); assertTrue("2Matched setAge method", intersection.matches(ITESTBEAN_SETAGE, TestBean.class)); assertTrue("3Matched setAge method", intersection.matches(ITESTBEAN_SETAGE, TestBean.class, new Integer(5))); // Knock out dynamic part intersection = MethodMatchers.intersection(intersection, new TestDynamicMethodMatcherWhichDoesNotMatch()); assertTrue("Intersection is a dynamic matcher", intersection.isRuntime()); assertTrue("2Matched setAge method", intersection.matches(ITESTBEAN_SETAGE, TestBean.class)); assertFalse("3 - not Matched setAge method", intersection.matches(ITESTBEAN_SETAGE, TestBean.class, new Integer(5))); }
@Test public void testSingle() throws Exception { MethodMatcher defaultMm = MethodMatcher.TRUE; assertTrue(defaultMm.matches(EXCEPTION_GETMESSAGE, Exception.class)); assertTrue(defaultMm.matches(ITESTBEAN_SETAGE, TestBean.class)); defaultMm = MethodMatchers.intersection(defaultMm, new StartsWithMatcher("get")); assertTrue(defaultMm.matches(EXCEPTION_GETMESSAGE, Exception.class)); assertFalse(defaultMm.matches(ITESTBEAN_SETAGE, TestBean.class)); }
/** * Apply an intersection with the given MethodMatcher. * @param other the MethodMatcher to apply an intersection with * @return this composable pointcut (for call chaining) */ public ComposablePointcut intersection(MethodMatcher other) { this.methodMatcher = MethodMatchers.intersection(this.methodMatcher, other); return this; }
/** * Apply an intersection with the given MethodMatcher. * @param other the MethodMatcher to apply an intersection with * @return this composable pointcut (for call chaining) */ public ComposablePointcut intersection(MethodMatcher other) { this.methodMatcher = MethodMatchers.intersection(this.methodMatcher, other); return this; }
public ComposablePointcut intersection(MethodMatcher mm) { this.methodMatcher = MethodMatchers.intersection(this.methodMatcher, mm); return this; }
/** * Apply an intersection with the given Pointcut. * @param other the Pointcut to apply an intersection with * @return this composable pointcut (for call chaining) */ public ComposablePointcut intersection(Pointcut other) { this.classFilter = ClassFilters.intersection(this.classFilter, other.getClassFilter()); this.methodMatcher = MethodMatchers.intersection(this.methodMatcher, other.getMethodMatcher()); return this; }
public ComposablePointcut intersection(Pointcut other) { this.classFilter = ClassFilters.intersection(this.classFilter, other.getClassFilter()); this.methodMatcher = MethodMatchers.intersection(this.methodMatcher, other.getMethodMatcher()); return this; }
/** * Apply an intersection with the given Pointcut. * @param other the Pointcut to apply an intersection with * @return this composable pointcut (for call chaining) */ public ComposablePointcut intersection(Pointcut other) { this.classFilter = ClassFilters.intersection(this.classFilter, other.getClassFilter()); this.methodMatcher = MethodMatchers.intersection(this.methodMatcher, other.getMethodMatcher()); return this; }
/** * Build a 'safe' pointcut that excludes the AspectJ advice method itself. * @return a composable pointcut that builds on the original AspectJ expression pointcut * @see #getPointcut() */ public final Pointcut buildSafePointcut() { Pointcut pc = getPointcut(); MethodMatcher safeMethodMatcher = MethodMatchers.intersection( new AdviceExcludingMethodMatcher(this.aspectJAdviceMethod), pc.getMethodMatcher()); return new ComposablePointcut(pc.getClassFilter(), safeMethodMatcher); }
/** * Build a 'safe' pointcut that excludes the AspectJ advice method itself. * @return a composable pointcut that builds on the original AspectJ expression pointcut * @see #getPointcut() */ public final Pointcut buildSafePointcut() { Pointcut pc = getPointcut(); MethodMatcher safeMethodMatcher = MethodMatchers.intersection( new AdviceExcludingMethodMatcher(this.aspectJAdviceMethod), pc.getMethodMatcher()); return new ComposablePointcut(pc.getClassFilter(), safeMethodMatcher); }