Java Code Examples for org.springframework.aop.MethodMatcher#matches()
The following examples show how to use
org.springframework.aop.MethodMatcher#matches() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Pointcuts.java From spring-analysis-note with MIT License | 6 votes |
/** * Perform the least expensive check for a pointcut match. * @param pointcut the pointcut to match * @param method the candidate method * @param targetClass the target class * @param args arguments to the method * @return whether there's a runtime match */ public static boolean matches(Pointcut pointcut, Method method, Class<?> targetClass, Object... args) { Assert.notNull(pointcut, "Pointcut must not be null"); if (pointcut == Pointcut.TRUE) { return true; } if (pointcut.getClassFilter().matches(targetClass)) { // Only check if it gets past first hurdle. MethodMatcher mm = pointcut.getMethodMatcher(); if (mm.matches(method, targetClass)) { // We may need additional runtime (argument) check. return (!mm.isRuntime() || mm.matches(method, targetClass, args)); } } return false; }
Example 2
Source File: Pointcuts.java From java-technology-stack with MIT License | 6 votes |
/** * Perform the least expensive check for a pointcut match. * @param pointcut the pointcut to match * @param method the candidate method * @param targetClass the target class * @param args arguments to the method * @return whether there's a runtime match */ public static boolean matches(Pointcut pointcut, Method method, Class<?> targetClass, Object... args) { Assert.notNull(pointcut, "Pointcut must not be null"); if (pointcut == Pointcut.TRUE) { return true; } if (pointcut.getClassFilter().matches(targetClass)) { // Only check if it gets past first hurdle. MethodMatcher mm = pointcut.getMethodMatcher(); if (mm.matches(method, targetClass)) { // We may need additional runtime (argument) check. return (!mm.isRuntime() || mm.matches(method, targetClass, args)); } } return false; }
Example 3
Source File: Pointcuts.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Perform the least expensive check for a pointcut match. * @param pointcut the pointcut to match * @param method the candidate method * @param targetClass the target class * @param args arguments to the method * @return whether there's a runtime match */ public static boolean matches(Pointcut pointcut, Method method, Class<?> targetClass, Object... args) { Assert.notNull(pointcut, "Pointcut must not be null"); if (pointcut == Pointcut.TRUE) { return true; } if (pointcut.getClassFilter().matches(targetClass)) { // Only check if it gets past first hurdle. MethodMatcher mm = pointcut.getMethodMatcher(); if (mm.matches(method, targetClass)) { // We may need additional runtime (argument) check. return (!mm.isRuntime() || mm.matches(method, targetClass, args)); } } return false; }
Example 4
Source File: Pointcuts.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Perform the least expensive check for a pointcut match. * @param pointcut the pointcut to match * @param method the candidate method * @param targetClass the target class * @param args arguments to the method * @return whether there's a runtime match */ public static boolean matches(Pointcut pointcut, Method method, Class<?> targetClass, Object[] args) { Assert.notNull(pointcut, "Pointcut must not be null"); if (pointcut == Pointcut.TRUE) { return true; } if (pointcut.getClassFilter().matches(targetClass)) { // Only check if it gets past first hurdle. MethodMatcher mm = pointcut.getMethodMatcher(); if (mm.matches(method, targetClass)) { // We may need additional runtime (argument) check. return (!mm.isRuntime() || mm.matches(method, targetClass, args)); } } return false; }
Example 5
Source File: MethodMatchers.java From spring-analysis-note with MIT License | 3 votes |
/** * Apply the given MethodMatcher to the given Method, supporting an * {@link org.springframework.aop.IntroductionAwareMethodMatcher} * (if applicable). * @param mm the MethodMatcher to apply (may be an IntroductionAwareMethodMatcher) * @param method the candidate method * @param targetClass the target class * @param hasIntroductions {@code true} if the object on whose behalf we are * asking is the subject on one or more introductions; {@code false} otherwise * @return whether or not this method matches statically */ public static boolean matches(MethodMatcher mm, Method method, Class<?> targetClass, boolean hasIntroductions) { Assert.notNull(mm, "MethodMatcher must not be null"); return (mm instanceof IntroductionAwareMethodMatcher ? ((IntroductionAwareMethodMatcher) mm).matches(method, targetClass, hasIntroductions) : mm.matches(method, targetClass)); }
Example 6
Source File: MethodMatchers.java From java-technology-stack with MIT License | 3 votes |
/** * Apply the given MethodMatcher to the given Method, supporting an * {@link org.springframework.aop.IntroductionAwareMethodMatcher} * (if applicable). * @param mm the MethodMatcher to apply (may be an IntroductionAwareMethodMatcher) * @param method the candidate method * @param targetClass the target class * @param hasIntroductions {@code true} if the object on whose behalf we are * asking is the subject on one or more introductions; {@code false} otherwise * @return whether or not this method matches statically */ public static boolean matches(MethodMatcher mm, Method method, Class<?> targetClass, boolean hasIntroductions) { Assert.notNull(mm, "MethodMatcher must not be null"); return (mm instanceof IntroductionAwareMethodMatcher ? ((IntroductionAwareMethodMatcher) mm).matches(method, targetClass, hasIntroductions) : mm.matches(method, targetClass)); }
Example 7
Source File: MethodMatchers.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Apply the given MethodMatcher to the given Method, supporting an * {@link org.springframework.aop.IntroductionAwareMethodMatcher} * (if applicable). * @param mm the MethodMatcher to apply (may be an IntroductionAwareMethodMatcher) * @param method the candidate method * @param targetClass the target class (may be {@code null}, in which case * the candidate class must be taken to be the method's declaring class) * @param hasIntroductions {@code true} if the object on whose behalf we are * asking is the subject on one or more introductions; {@code false} otherwise * @return whether or not this method matches statically */ public static boolean matches(MethodMatcher mm, Method method, Class<?> targetClass, boolean hasIntroductions) { Assert.notNull(mm, "MethodMatcher must not be null"); return ((mm instanceof IntroductionAwareMethodMatcher && ((IntroductionAwareMethodMatcher) mm).matches(method, targetClass, hasIntroductions)) || mm.matches(method, targetClass)); }
Example 8
Source File: MethodMatchers.java From spring4-understanding with Apache License 2.0 | 3 votes |
/** * Apply the given MethodMatcher to the given Method, supporting an * {@link org.springframework.aop.IntroductionAwareMethodMatcher} * (if applicable). * @param mm the MethodMatcher to apply (may be an IntroductionAwareMethodMatcher) * @param method the candidate method * @param targetClass the target class (may be {@code null}, in which case * the candidate class must be taken to be the method's declaring class) * @param hasIntroductions {@code true} if the object on whose behalf we are * asking is the subject on one or more introductions; {@code false} otherwise * @return whether or not this method matches statically */ public static boolean matches(MethodMatcher mm, Method method, Class<?> targetClass, boolean hasIntroductions) { Assert.notNull(mm, "MethodMatcher must not be null"); return ((mm instanceof IntroductionAwareMethodMatcher && ((IntroductionAwareMethodMatcher) mm).matches(method, targetClass, hasIntroductions)) || mm.matches(method, targetClass)); }