Example usage for org.springframework.aop.support DefaultIntroductionAdvisor DefaultIntroductionAdvisor

List of usage examples for org.springframework.aop.support DefaultIntroductionAdvisor DefaultIntroductionAdvisor

Introduction

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

Prototype

public DefaultIntroductionAdvisor(DynamicIntroductionAdvice advice, Class<?> intf) 

Source Link

Document

Create a DefaultIntroductionAdvisor for the given advice.

Usage

From source file:org.springframework.aop.framework.AdvisedSupport.java

/**
 * Cannot add introductions this way unless the advice implements IntroductionInfo.
 */// www . j ava2 s  .c om
public void addAdvice(int pos, Advice advice) throws AopConfigException {
    if (advice instanceof Interceptor && !(advice instanceof MethodInterceptor)) {
        throw new AopConfigException(getClass().getName() + " only handles AOP Alliance MethodInterceptors");
    }

    if (advice instanceof IntroductionInfo) {
        // We don't need an IntroductionAdvisor for this kind of introduction:
        // It's fully self-describing.
        addAdvisor(pos, new DefaultIntroductionAdvisor(advice, (IntroductionInfo) advice));
    } else if (advice instanceof DynamicIntroductionAdvice) {
        // We need an IntroductionAdvisor for this kind of introduction.
        throw new AopConfigException(
                "DynamicIntroductionAdvice may only be added as part of IntroductionAdvisor");
    } else {
        addAdvisor(pos, new DefaultPointcutAdvisor(advice));
    }
}