Search in sources :

Example 1 with ComposablePointcut

use of org.springframework.aop.support.ComposablePointcut in project druid by alibaba.

the class StatAnnotationAdvisor method buildPointcut.

protected Pointcut buildPointcut() {
    Pointcut cpc = new AnnotationMatchingPointcut(Stat.class, true);
    Pointcut mpc = AnnotationMatchingPointcut.forMethodAnnotation(Stat.class);
    ComposablePointcut result = new ComposablePointcut(cpc).union(mpc);
    return result;
}
Also used : ComposablePointcut(org.springframework.aop.support.ComposablePointcut) Pointcut(org.springframework.aop.Pointcut) AnnotationMatchingPointcut(org.springframework.aop.support.annotation.AnnotationMatchingPointcut) AnnotationMatchingPointcut(org.springframework.aop.support.annotation.AnnotationMatchingPointcut) ComposablePointcut(org.springframework.aop.support.ComposablePointcut)

Example 2 with ComposablePointcut

use of org.springframework.aop.support.ComposablePointcut in project spring-framework by spring-projects.

the class AbstractAspectJAdvice method buildSafePointcut.

/**
	 * Build a 'safe' pointcut that excludes the AspectJ advice method itself.
	 * @return a composable pointcut that builds on the original AspectJ expression pointcut
	 * @see #getPointcut()
	 */
public final Pointcut buildSafePointcut() {
    Pointcut pc = getPointcut();
    MethodMatcher safeMethodMatcher = MethodMatchers.intersection(new AdviceExcludingMethodMatcher(this.aspectJAdviceMethod), pc.getMethodMatcher());
    return new ComposablePointcut(pc.getClassFilter(), safeMethodMatcher);
}
Also used : ComposablePointcut(org.springframework.aop.support.ComposablePointcut) Pointcut(org.springframework.aop.Pointcut) MethodMatcher(org.springframework.aop.MethodMatcher) StaticMethodMatcher(org.springframework.aop.support.StaticMethodMatcher) ComposablePointcut(org.springframework.aop.support.ComposablePointcut)

Example 3 with ComposablePointcut

use of org.springframework.aop.support.ComposablePointcut in project spring-framework by spring-projects.

the class AsyncAnnotationAdvisor method buildPointcut.

/**
	 * Calculate a pointcut for the given async annotation types, if any.
	 * @param asyncAnnotationTypes the async annotation types to introspect
	 * @return the applicable Pointcut object, or {@code null} if none
	 */
protected Pointcut buildPointcut(Set<Class<? extends Annotation>> asyncAnnotationTypes) {
    ComposablePointcut result = null;
    for (Class<? extends Annotation> asyncAnnotationType : asyncAnnotationTypes) {
        Pointcut cpc = new AnnotationMatchingPointcut(asyncAnnotationType, true);
        Pointcut mpc = AnnotationMatchingPointcut.forMethodAnnotation(asyncAnnotationType);
        if (result == null) {
            result = new ComposablePointcut(cpc);
        } else {
            result.union(cpc);
        }
        result = result.union(mpc);
    }
    return result;
}
Also used : ComposablePointcut(org.springframework.aop.support.ComposablePointcut) Pointcut(org.springframework.aop.Pointcut) AnnotationMatchingPointcut(org.springframework.aop.support.annotation.AnnotationMatchingPointcut) AnnotationMatchingPointcut(org.springframework.aop.support.annotation.AnnotationMatchingPointcut) ComposablePointcut(org.springframework.aop.support.ComposablePointcut)

Aggregations

Pointcut (org.springframework.aop.Pointcut)3 ComposablePointcut (org.springframework.aop.support.ComposablePointcut)3 AnnotationMatchingPointcut (org.springframework.aop.support.annotation.AnnotationMatchingPointcut)2 MethodMatcher (org.springframework.aop.MethodMatcher)1 StaticMethodMatcher (org.springframework.aop.support.StaticMethodMatcher)1