public void removeAdvisor(int index) throws AopConfigException {
    if (isFrozen()) {
      throw new AopConfigException("Cannot remove Advisor: config is frozen");
    }
    if (index < 0 || index > this.advisors.size() - 1) {
      throw new AopConfigException(
          "Advisor index "
              + index
              + " is out of bounds: "
              + "Only have "
              + 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();
  }
  public void addAdvisor(int pos, IntroductionAdvisor advisor) throws AopConfigException {
    advisor.validateInterfaces();

    // 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);
  }