Example usage for org.springframework.aop IntroductionAdvisor getInterfaces

List of usage examples for org.springframework.aop IntroductionAdvisor getInterfaces

Introduction

In this page you can find the example usage for org.springframework.aop IntroductionAdvisor getInterfaces.

Prototype

Class<?>[] getInterfaces();

Source Link

Document

Return the additional interfaces introduced by this Advisor or Advice.

Usage

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

public void removeAdvisor(int index) throws AopConfigException {
    if (isFrozen()) {
        throw new AopConfigException("Cannot remove Advisor: Configuration is frozen.");
    }/* ww w.j a  va 2s  .c  om*/
    if (index < 0 || index > this.advisors.size() - 1) {
        throw new AopConfigException("Advisor index " + index + " is out of bounds: "
                + "This configuration only has " + this.advisors.size() + " advisors.");
    }

    Advisor advisor = (Advisor) this.advisors.get(index);
    if (advisor instanceof IntroductionAdvisor) {
        IntroductionAdvisor ia = (IntroductionAdvisor) advisor;
        // we need to remove interfaces
        for (int j = 0; j < ia.getInterfaces().length; j++) {
            removeInterface(ia.getInterfaces()[j]);
        }
    }

    this.advisors.remove(index);
    updateAdvisorArray();
    adviceChanged();
}

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

public void addAdvisor(int pos, IntroductionAdvisor advisor) throws AopConfigException {
    advisor.validateInterfaces();//  ww  w  . jav a 2s . c o  m

    // If the advisor passed validation, we can make the change.
    for (int i = 0; i < advisor.getInterfaces().length; i++) {
        addInterface(advisor.getInterfaces()[i]);
    }
    addAdvisorInternal(pos, advisor);
}