/** * Match all methods that <i>either</i> (or both) of the given MethodMatchers matches. * @param mm1 the first MethodMatcher * @param mm2 the second MethodMatcher * @return a distinct MethodMatcher that matches all methods that either * of the given MethodMatchers matches */ public static MethodMatcher union(MethodMatcher mm1, MethodMatcher mm2) { return (mm1 instanceof IntroductionAwareMethodMatcher || mm2 instanceof IntroductionAwareMethodMatcher ? new UnionIntroductionAwareMethodMatcher(mm1, mm2) : new UnionMethodMatcher(mm1, mm2)); }
@Override public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) { return (matchesClass1(targetClass) && MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions)) || (matchesClass2(targetClass) && MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions)); } }
@Override public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) { return (matchesClass1(targetClass) && MethodMatchers.matches(this.mm1, method, targetClass, hasIntroductions)) || (matchesClass2(targetClass) && MethodMatchers.matches(this.mm2, method, targetClass, hasIntroductions)); } }
/** * Match all methods that <i>either</i> (or both) of the given MethodMatchers matches. * @param mm1 the first MethodMatcher * @param mm2 the second MethodMatcher * @return a distinct MethodMatcher that matches all methods that either * of the given MethodMatchers matches */ public static MethodMatcher union(MethodMatcher mm1, MethodMatcher mm2) { return (mm1 instanceof IntroductionAwareMethodMatcher || mm2 instanceof IntroductionAwareMethodMatcher ? new UnionIntroductionAwareMethodMatcher(mm1, mm2) : new UnionMethodMatcher(mm1, mm2)); }