Package org.springframework.aop

Examples of org.springframework.aop.Advisor


   */
  protected List sortAdvisors(List advisors) {
    // build list for sorting
    List partiallyComparableAdvisors = new LinkedList();
    for (Iterator it = advisors.iterator(); it.hasNext();) {
      Advisor element = (Advisor) it.next();
      PartiallyComparableAdvisorHolder advisor =
          new PartiallyComparableAdvisorHolder(element, DEFAULT_PRECEDENCE_COMPARATOR);
      partiallyComparableAdvisors.add(advisor);
    }   
   
View Full Code Here


  protected boolean shouldSkip(Class beanClass, String beanName) {
    // TODO: Consider optimization by caching the list of the aspect names
    List candidtate = findCandidateAdvisors();
    for (Iterator it = candidtate.iterator(); it.hasNext();) {
      Advisor advisor = (Advisor) it.next();
      if (advisor instanceof AspectJPointcutAdvisor) {
        if(((AbstractAspectJAdvice) advisor.getAdvice()).getAspectName().equals(beanName)) {
          return true;
        }
      }
    }
    return super.shouldSkip(beanClass, beanName);
View Full Code Here

      this.advisor = advisor;
      this.comparator = comparator;
    }

    public int compareTo(Object obj) {
      Advisor otherAdvisor = ((PartiallyComparableAdvisorHolder) obj).advisor;
      return this.comparator.compare(this.advisor, otherAdvisor);
    }
View Full Code Here

      throw new IllegalArgumentException(
          "AspectJPrecedenceComparator can only compare the order of Advisors, " +
          "but was passed [" + o1 + "] and [" + o2 + "]");
    }

    Advisor advisor1 = (Advisor) o1;
    Advisor advisor2 = (Advisor) o2;

    boolean oneOrOtherIsAfterAdvice =
        (AspectJAopUtils.isAfterAdvice(advisor1) || AspectJAopUtils.isAfterAdvice(advisor2));
    boolean oneOrOtherIsBeforeAdvice =
        (AspectJAopUtils.isBeforeAdvice(advisor1) || AspectJAopUtils.isBeforeAdvice(advisor2));
View Full Code Here

    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 introduction interfaces.
      for (int j = 0; j < ia.getInterfaces().length; j++) {
        removeInterface(ia.getInterfaces()[j]);
View Full Code Here

    if (isFrozen()) {
      throw new AopConfigException("Cannot add advisor: Configuration is frozen.");
    }
    if (!ObjectUtils.isEmpty(advisors)) {
      for (int i = 0; i < advisors.length; i++) {
        Advisor advisor = advisors[i];
        if (advisor instanceof IntroductionAdvisor) {
          validateIntroductionAdvisor((IntroductionAdvisor) advisor);
        }
        Assert.notNull(advisor, "Advisor must not be null");
        this.advisors.add(advisor);
View Full Code Here

  }

  public int indexOf(Advice advice) {
    Assert.notNull(advice, "Advice must not be null");
    for (int i = 0; i < this.advisors.size(); i++) {
      Advisor advisor = (Advisor) this.advisors.get(i);
      if (advisor.getAdvice() == advice) {
        return i;
      }
    }
    return -1;
  }
View Full Code Here

   * @return whether this advice instance is included
   */
  public boolean adviceIncluded(Advice advice) {
    Assert.notNull(advice, "Advice must not be null");
    for (int i = 0; i < this.advisors.size(); i++) {
      Advisor advisor = (Advisor) this.advisors.get(i);
      if (advisor.getAdvice() == advice) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

   */
  public int countAdvicesOfType(Class adviceClass) {
    Assert.notNull(adviceClass, "Advice class must not be null");
    int count = 0;
    for (int i = 0; i < this.advisors.size(); i++) {
      Advisor advisor = (Advisor) this.advisors.get(i);
      if (advisor.getAdvice() != null &&
          adviceClass.isAssignableFrom(advisor.getAdvice().getClass())) {
        count++;
      }
    }
    return count;
  }
View Full Code Here

    copyFrom(other);
    this.targetSource = targetSource;
    this.advisorChainFactory = other.advisorChainFactory;
    this.interfaces = new ArrayList(other.interfaces);
    for (Iterator it = advisors.iterator(); it.hasNext();) {
      Advisor advisor = (Advisor) it.next();
      if (advisor instanceof IntroductionAdvisor) {
        validateIntroductionAdvisor((IntroductionAdvisor) advisor);
      }
      Assert.notNull(advisor, "Advisor must not be null");
      this.advisors.add(advisor);
View Full Code Here

TOP

Related Classes of org.springframework.aop.Advisor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.