/** * Apply a union with the given MethodMatcher. * @param other the MethodMatcher to apply a union with * @return this composable pointcut (for call chaining) */ public ComposablePointcut union(MethodMatcher other) { this.methodMatcher = MethodMatchers.union(this.methodMatcher, other); return this; }
/** * Apply a union with the given Pointcut. * <p>Note that for a Pointcut union, methods will only match if their * original ClassFilter (from the originating Pointcut) matches as well. * MethodMatchers and ClassFilters from different Pointcuts will never * get interleaved with each other. * @param other the Pointcut to apply a union with * @return this composable pointcut (for call chaining) */ public ComposablePointcut union(Pointcut other) { this.methodMatcher = MethodMatchers.union( this.methodMatcher, this.classFilter, other.getMethodMatcher(), other.getClassFilter()); this.classFilter = ClassFilters.union(this.classFilter, other.getClassFilter()); return this; }
@Test public void testUnionEquals() { MethodMatcher first = MethodMatchers.union(MethodMatcher.TRUE, MethodMatcher.TRUE); MethodMatcher second = new ComposablePointcut(MethodMatcher.TRUE).union(new ComposablePointcut(MethodMatcher.TRUE)).getMethodMatcher(); assertTrue(first.equals(second)); assertTrue(second.equals(first)); }
@Test public void testStaticMethodMatcherUnion() throws Exception { MethodMatcher getterMatcher = new StartsWithMatcher("get"); MethodMatcher setterMatcher = new StartsWithMatcher("set"); MethodMatcher union = MethodMatchers.union(getterMatcher, setterMatcher); assertFalse("Union is a static matcher", union.isRuntime()); assertTrue("Matched setAge method", union.matches(ITESTBEAN_SETAGE, TestBean.class)); assertTrue("Matched getAge method", union.matches(ITESTBEAN_GETAGE, TestBean.class)); assertFalse("Didn't matched absquatulate method", union.matches(IOTHER_ABSQUATULATE, TestBean.class)); }
/** * Apply a union with the given MethodMatcher. * @param other the MethodMatcher to apply a union with * @return this composable pointcut (for call chaining) */ public ComposablePointcut union(MethodMatcher other) { this.methodMatcher = MethodMatchers.union(this.methodMatcher, other); return this; }
/** * Apply a union with the given MethodMatcher. * @param other the MethodMatcher to apply a union with * @return this composable pointcut (for call chaining) */ public ComposablePointcut union(MethodMatcher other) { this.methodMatcher = MethodMatchers.union(this.methodMatcher, other); return this; }
public ComposablePointcut union(MethodMatcher mm) { this.methodMatcher = MethodMatchers.union(this.methodMatcher, mm); return this; }
/** * Apply a union with the given Pointcut. * <p>Note that for a Pointcut union, methods will only match if their * original ClassFilter (from the originating Pointcut) matches as well. * MethodMatchers and ClassFilters from different Pointcuts will never * get interleaved with each other. * @param other the Pointcut to apply a union with * @return this composable pointcut (for call chaining) */ public ComposablePointcut union(Pointcut other) { this.methodMatcher = MethodMatchers.union( this.methodMatcher, this.classFilter, other.getMethodMatcher(), other.getClassFilter()); this.classFilter = ClassFilters.union(this.classFilter, other.getClassFilter()); return this; }
/** * Apply a union with the given Pointcut. * <p>Note that for a Pointcut union, methods will only match if their * original ClassFilter (from the originating Pointcut) matches as well. * MethodMatchers and ClassFilters from different Pointcuts will never * get interleaved with each other. * @param other the Pointcut to apply a union with * @return this composable pointcut (for call chaining) */ public ComposablePointcut union(Pointcut other) { this.methodMatcher = MethodMatchers.union( this.methodMatcher, this.classFilter, other.getMethodMatcher(), other.getClassFilter()); this.classFilter = ClassFilters.union(this.classFilter, other.getClassFilter()); return this; }