Example usage for org.aspectj.weaver.tools ShadowMatch alwaysMatches

List of usage examples for org.aspectj.weaver.tools ShadowMatch alwaysMatches

Introduction

In this page you can find the example usage for org.aspectj.weaver.tools ShadowMatch alwaysMatches.

Prototype

boolean alwaysMatches();

Source Link

Document

True iff the pointcut expression will match any join point at this shadow (for example, any call to the given method).

Usage

From source file:com.gwtent.aop.matcher.AspectJExpress.java

License:Apache License

public boolean matches(Method method, Class<?> targetClass, Object... args) {
    checkReadyToMatch();// www.  j  a  v  a 2 s  .  c o m
    //      ShadowMatch shadowMatch = null;
    ShadowMatch originalShadowMatch = null;
    try {
        //shadowMatch = getShadowMatch(AopUtils.getMostSpecificMethod(method, targetClass), method);
        originalShadowMatch = getShadowMatch(method, method);
        if (originalShadowMatch.alwaysMatches())
            return true;
        else
            return matchesByMethodMatcher(method, targetClass, args);

    } catch (ReflectionWorld.ReflectionWorldException ex) {
        // Could neither introspect the target class nor the proxy class ->
        // let's simply consider this method as non-matching.
        return false;
    }
}

From source file:org.gaixie.micrite.security.filter.AspectJMethodMatcher.java

License:Open Source License

public boolean match(String pattern, Method method) {
    pattern = "execution(" + pattern + ")";
    PointcutExpression pe = pointcutParser.parsePointcutExpression(pattern);
    ShadowMatch match = pe.matchesMethodExecution(method);
    return match.alwaysMatches();
}

From source file:org.springframework.aop.aspectj.AspectJExpressionPointcut.java

License:Apache License

@Override
public boolean matches(Method method, Class<?> targetClass, boolean beanHasIntroductions) {
    checkReadyToMatch();/*  ww w .j  av a  2 s . c o  m*/
    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));
    }
}