Package org.springframework.aop

Examples of org.springframework.aop.Advisor


   * bean factory
   */
  private void addAdvisorOnChainCreation(Object next, String name) {
    // We need to convert to an Advisor if necessary so that our source reference
    // matches what we find from superclass interceptors.
    Advisor advisor = namedBeanToAdvisor(next);
    if (logger.isTraceEnabled()) {
      logger.trace("Adding advisor with name '" + name + "'");
    }     
    addAdvisor((Advisor) advisor);
  }
View Full Code Here


    if (candidateAdvisors.isEmpty()) {
      return candidateAdvisors;
    }
    List eligibleAdvisors = new LinkedList();
    for (Iterator it = candidateAdvisors.iterator(); it.hasNext();) {
      Advisor candidate = (Advisor) it.next();
      if (candidate instanceof IntroductionAdvisor && canApply(candidate, clazz)) {
        eligibleAdvisors.add(candidate);
      }
    }
    boolean hasIntroductions = !eligibleAdvisors.isEmpty();
    for (Iterator it = candidateAdvisors.iterator(); it.hasNext();) {
      Advisor candidate = (Advisor) it.next();
      if (candidate instanceof IntroductionAdvisor) {
        // already processed
        continue;
      }
      if (canApply(candidate, clazz, hasIntroductions)) {
View Full Code Here

   */
  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

    final List<Advisor> advisors = new LinkedList<Advisor>();
    ReflectionUtils.doWithMethods(aspectClass, new ReflectionUtils.MethodCallback() {
      public void doWith(Method method) throws IllegalArgumentException {
        // Exclude pointcuts
        if (AnnotationUtils.getAnnotation(method, Pointcut.class) == null) {
          Advisor advisor = getAdvisor(method, lazySingletonAspectInstanceFactory, advisors.size(), aspectName);
          if (advisor != null) {
            advisors.add(advisor);
          }
        }
      }
    });

    // If it's a per target aspect, emit the dummy instantiating aspect.
    if (!advisors.isEmpty() && lazySingletonAspectInstanceFactory.getAspectMetadata().isLazilyInstantiated()) {
      Advisor instantiationAdvisor = new SyntheticInstantiationAdvisor(lazySingletonAspectInstanceFactory);
      advisors.add(0, instantiationAdvisor);
    }

    // Find introduction fields.
    for (Field field : aspectClass.getDeclaredFields()) {
      Advisor advisor = getDeclareParentsAdvisor(field);
      if (advisor != null) {
        advisors.add(advisor);
      }
    }
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

          logger.debug("Refreshing bean named '" + pa.getBeanName() + "'");
        }
        // Replace the placeholder with a fresh prototype instance resulting
        // from a getBean() lookup
        Object bean = this.beanFactory.getBean(pa.getBeanName());
        Advisor refreshedAdvisor = namedBeanToAdvisor(bean);
        freshAdvisors.add(refreshedAdvisor);
      }
      else {
        // Add the shared instance.
        freshAdvisors.add(advisors[i]);
View Full Code Here

   * bean factory
   */
  private void addAdvisorOnChainCreation(Object next, String name) {
    // We need to convert to an Advisor if necessary so that our source reference
    // matches what we find from superclass interceptors.
    Advisor advisor = namedBeanToAdvisor(next);
    if (logger.isTraceEnabled()) {
      logger.trace("Adding advisor with name '" + name + "'");
    }     
    addAdvisor((Advisor) advisor);
  }
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

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.