Java Code Examples for org.aspectj.weaver.tools.ShadowMatch#alwaysMatches()
The following examples show how to use
org.aspectj.weaver.tools.ShadowMatch#alwaysMatches() .
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: AspectJExpressionPointcut.java From toy-spring with Apache License 2.0 | 6 votes |
/** * 使用 AspectJ Expression 匹配方法 * @param method * @param targetClass * @return 成功匹配返回 true,否则返回 false */ @Override public Boolean matchers(Method method, Class targetClass) { checkReadyToMatche(); ShadowMatch shadowMatch = pointcutExpression.matchesMethodExecution(method); // Special handling for this, target, @this, @target, @annotation // in Spring - we can optimize since we know we have exactly this class, // and there will never be matching subclass at runtime. // https://github.com/spring-projects/spring-framework/blob/master/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java if (shadowMatch.alwaysMatches()) { return true; } else if (shadowMatch.neverMatches()) { return false; } return false; }
Example 2
Source File: AspectJExpressionPointcut.java From spring-analysis-note with MIT License | 5 votes |
@Override public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) { obtainPointcutExpression(); ShadowMatch shadowMatch = getTargetShadowMatch(method, targetClass); // Special handling for this, target, @this, @target, @annotation // in Spring - we can optimize since we know we have exactly this class, // and there will never be matching subclass at runtime. if (shadowMatch.alwaysMatches()) { return true; } else if (shadowMatch.neverMatches()) { return false; } else { // the maybe case if (hasIntroductions) { return true; } // A match test returned maybe - if there are any subtype sensitive variables // involved in the test (this, target, at_this, at_target, at_annotation) then // we say this is not a match as in Spring there will never be a different // runtime subtype. RuntimeTestWalker walker = getRuntimeTestWalker(shadowMatch); return (!walker.testsSubtypeSensitiveVars() || walker.testTargetInstanceOfResidue(targetClass)); } }
Example 3
Source File: AspectJExpressionPointcut.java From java-technology-stack with MIT License | 5 votes |
@Override public boolean matches(Method method, Class<?> targetClass, boolean hasIntroductions) { obtainPointcutExpression(); ShadowMatch shadowMatch = getTargetShadowMatch(method, targetClass); // Special handling for this, target, @this, @target, @annotation // in Spring - we can optimize since we know we have exactly this class, // and there will never be matching subclass at runtime. if (shadowMatch.alwaysMatches()) { return true; } else if (shadowMatch.neverMatches()) { return false; } else { // the maybe case if (hasIntroductions) { return true; } // A match test returned maybe - if there are any subtype sensitive variables // involved in the test (this, target, at_this, at_target, at_annotation) then // we say this is not a match as in Spring there will never be a different // runtime subtype. RuntimeTestWalker walker = getRuntimeTestWalker(shadowMatch); return (!walker.testsSubtypeSensitiveVars() || walker.testTargetInstanceOfResidue(targetClass)); } }
Example 4
Source File: ProxyPointcut.java From doodle with Apache License 2.0 | 5 votes |
/** * Method是否匹配切点表达式 * * @param method 目标方法 * @return 是否匹配 */ public boolean matches(Method method) { checkReadyToMatch(); ShadowMatch shadowMatch = pointcutExpression.matchesMethodExecution(method); if (shadowMatch.alwaysMatches()) { return true; } else if (shadowMatch.neverMatches()) { return false; } return false; }
Example 5
Source File: ExpressionMatcher.java From defender with Apache License 2.0 | 5 votes |
@Override public boolean match(Caller caller, String pattern) { if(! pattern.startsWith("execution")) { pattern = "execution(" + pattern + ")"; } PointcutExpression pe = cache.get(pattern); if(pe == null) { PointcutParser pp = PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution(); pe = pp.parsePointcutExpression(pattern); cache.set(pattern, pe); } ShadowMatch sm = pe.matchesMethodExecution(caller.getTargetMethod()); return sm.alwaysMatches(); }
Example 6
Source File: AspectJExpressionPointcut.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public boolean matches(Method method, Class<?> targetClass, boolean beanHasIntroductions) { checkReadyToMatch(); Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass); ShadowMatch shadowMatch = getShadowMatch(targetMethod, method); // Special handling for this, target, @this, @target, @annotation // in Spring - we can optimize since we know we have exactly this class, // and there will never be matching subclass at runtime. if (shadowMatch.alwaysMatches()) { return true; } else if (shadowMatch.neverMatches()) { return false; } else { // the maybe case if (beanHasIntroductions) { return true; } // A match test returned maybe - if there are any subtype sensitive variables // involved in the test (this, target, at_this, at_target, at_annotation) then // we say this is not a match as in Spring there will never be a different // runtime subtype. RuntimeTestWalker walker = getRuntimeTestWalker(shadowMatch); return (!walker.testsSubtypeSensitiveVars() || walker.testTargetInstanceOfResidue(targetClass)); } }
Example 7
Source File: AspectJExpressionPointcut.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public boolean matches(Method method, Class<?> targetClass, boolean beanHasIntroductions) { checkReadyToMatch(); Method targetMethod = AopUtils.getMostSpecificMethod(method, targetClass); ShadowMatch shadowMatch = getShadowMatch(targetMethod, method); // Special handling for this, target, @this, @target, @annotation // in Spring - we can optimize since we know we have exactly this class, // and there will never be matching subclass at runtime. if (shadowMatch.alwaysMatches()) { return true; } else if (shadowMatch.neverMatches()) { return false; } else { // the maybe case if (beanHasIntroductions) { return true; } // A match test returned maybe - if there are any subtype sensitive variables // involved in the test (this, target, at_this, at_target, at_annotation) then // we say this is not a match as in Spring there will never be a different // runtime subtype. RuntimeTestWalker walker = getRuntimeTestWalker(shadowMatch); return (!walker.testsSubtypeSensitiveVars() || walker.testTargetInstanceOfResidue(targetClass)); } }
Example 8
Source File: AspectJExpressionPointcut.java From tiny-spring with Apache License 2.0 | 5 votes |
@Override public boolean matches(Method method, Class targetClass) { checkReadyToMatch(); ShadowMatch shadowMatch = pointcutExpression.matchesMethodExecution(method); if (shadowMatch.alwaysMatches()) { return true; } else if (shadowMatch.neverMatches()) { return false; } // TODO:其他情况不判断了!见org.springframework.aop.aspectj.RuntimeTestWalker return false; }
Example 9
Source File: AspectJExpressionPointcut.java From tiny-spring with Apache License 2.0 | 5 votes |
@Override public boolean matches(Method method, Class targetClass) { checkReadyToMatch(); ShadowMatch shadowMatch = pointcutExpression.matchesMethodExecution(method); if (shadowMatch.alwaysMatches()) { return true; } else if (shadowMatch.neverMatches()) { return false; } // TODO:其他情况不判断了!见org.springframework.aop.aspectj.RuntimeTestWalker return false; }
Example 10
Source File: AspectJExpressionPointcut.java From tiny-spring with Apache License 2.0 | 5 votes |
@Override public boolean matches(Method method, Class targetClass) { checkReadyToMatch(); ShadowMatch shadowMatch = pointcutExpression.matchesMethodExecution(method); if (shadowMatch.alwaysMatches()) { return true; } else if (shadowMatch.neverMatches()) { return false; } // TODO:其他情况不判断了!见org.springframework.aop.aspectj.RuntimeTestWalker return false; }