Example usage for org.springframework.aop.support ComposablePointcut union

List of usage examples for org.springframework.aop.support ComposablePointcut union

Introduction

In this page you can find the example usage for org.springframework.aop.support ComposablePointcut union.

Prototype

public ComposablePointcut union(Pointcut other) 

Source Link

Document

Apply a union with the given Pointcut.

Usage

From source file:prospring3.ch5.beanpostprocessor.DeassociatePointcutAdvisor.java

private Pointcut buildPointcut(Set<Class<? extends Annotation>> deassociateAnnotationTypes) {
    ComposablePointcut result = null;
    for (Class<? extends Annotation> deassociateAnnotationType : deassociateAnnotationTypes) {
        Pointcut mpc = new AnnotationMatchingPointcut(null, deassociateAnnotationType);
        if (result == null) {
            result = new ComposablePointcut(mpc);
        } else {/*  w w w .  j  a  v a  2  s . c  o  m*/
            result.union(mpc);
        }
    }
    return result;
}

From source file:org.activiti.spring.components.aop.ProcessStartingPointcutAdvisor.java

private Pointcut buildPointcut() {
    ComposablePointcut result = null;
    for (Class<? extends Annotation> publisherAnnotationType : this.annotations) {
        Pointcut mpc = new MetaAnnotationMatchingPointcut(null, publisherAnnotationType);
        if (result == null) {
            result = new ComposablePointcut(mpc);
        } else {//w w  w  .  jav  a  2  s. co  m
            result.union(mpc);
        }
    }
    return result;
}

From source file:org.anyframe.iam.admin.common.web.JsonErrorAdvisingBeanPostProcessor.java

@SuppressWarnings("unchecked")
public Object postProcessBeforeInitialization(final Object bean, String beanName) throws BeansException {

    //  ? bean ? 
    log.debug("postProcessBeforeInitialization with : " + beanName);

    Class clazz = bean.getClass();

    // JsonError Annotation ?  MethodMatcher
    AnnotationMethodMatcher annotationMethodMatcher = new AnnotationMethodMatcher(JsonError.class);

    // advice(JsonIAMException   JsonExceptionTransfer) + Pointcut 
    // ? Advisor/*from www  .ja  v  a  2 s  . c om*/
    DefaultPointcutAdvisor advisor = (DefaultPointcutAdvisor) context.getBean("jsonErrorAdvisor");

    //  bean Class ?     JsonError Annotation ?   
    // ?
    for (Method method : clazz.getDeclaredMethods()) {
        // JsonError Annotation ?   
        if (annotationMethodMatcher.matches(method, clazz)) {
            // maching method  
            log.debug("maching method : " + clazz.getSimpleName() + "." + method.getName());

            // jsonErrorAdvisor    Pointcut ?  -   JsonError
            // Annotation ?  Bean ?  Pointcut  
            if (advisor.getPointcut() == Pointcut.TRUE) {
                advisor.setPointcut(
                        new ComposablePointcut(new RootClassFilter(clazz), annotationMethodMatcher));
                //  ? Pointcut ?  ??  JsonError Annotation ?
                //  Bean ?  Pointcut ? union  ?.
            } else {
                ComposablePointcut pointcut = (ComposablePointcut) advisor.getPointcut();
                pointcut.union(new ComposablePointcut(new RootClassFilter(clazz), annotationMethodMatcher));
                advisor.setPointcut(pointcut);
            }
        }
    }

    return bean;
}