Package org.aopalliance.aop

Examples of org.aopalliance.aop.Advice


  }

  @Override
  public void afterPropertiesSet() {
    Pointcut pointcut = new AnnotationMatchingPointcut(this.validatedAnnotationType, true);
    Advice advice = (this.validator != null ? new MethodValidationInterceptor(this.validator) :
        new MethodValidationInterceptor());
    this.advisor = new DefaultPointcutAdvisor(pointcut, advice);
  }
View Full Code Here


    assertEquals(p, p2);
    assertNotSame(p, p2);
    assertEquals("serializableSingleton", p2.getName());

    // Add unserializable advice
    Advice nop = new NopInterceptor();
    ((Advised) p).addAdvice(nop);
    // Check it still works
    assertEquals(p2.getName(), p2.getName());
    assertFalse("Not serializable because an interceptor isn't serializable", SerializationTestUtils.isSerializable(p));
View Full Code Here

    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder();
      Advice advice = this.advisor.getAdvice();
      sb.append(ClassUtils.getShortName(advice.getClass()));
      sb.append(": ");
      if (this.advisor instanceof Ordered) {
        sb.append("order ").append(((Ordered) this.advisor).getOrder()).append(", ");
      }
      if (advice instanceof AbstractAspectJAdvice) {
View Full Code Here

      }
      return true;
    }

    private boolean equalsAdviceClasses(Advisor a, Advisor b) {
      Advice aa = a.getAdvice();
      Advice ba = b.getAdvice();
      if (aa == null || ba == null) {
        return (aa == ba);
      }
      return aa.getClass().equals(ba.getClass());
    }
View Full Code Here

    @Override
    public int hashCode() {
      int hashCode = 0;
      Advisor[] advisors = this.advised.getAdvisors();
      for (Advisor advisor : advisors) {
        Advice advice = advisor.getAdvice();
        if (advice != null) {
          hashCode = 13 * hashCode + advice.getClass().hashCode();
        }
      }
      hashCode = 13 * hashCode + (this.advised.isFrozen() ? 1 : 0);
      hashCode = 13 * hashCode + (this.advised.isExposeProxy() ? 1 : 0);
      hashCode = 13 * hashCode + (this.advised.isOptimize() ? 1 : 0);
View Full Code Here

    }

    final Class<?> targetClass = AopUtils.getTargetClass(bean);

    if (AopUtils.canApply(pointcut, targetClass)) {
      final Advice advice = adviceFactory.getAdvice(bean, targetClass);
      final Advisor advisor = new DefaultPointcutAdvisor(pointcut, advice);

      if (bean instanceof Advised) {
        LOG.debug("Bean {} is already proxied, adding Advisor to existing proxy", beanName);
View Full Code Here

      Method method, ProxyFactory pf) {
    int added = 0;
    for (String adviceName : pointcuts.keySet()) {
      Pointcut pc = pointcuts.get(adviceName);
      if (AopUtils.canApply(pc, originallyCreatedBean.getClass())) {
        Advice advice = (Advice) childBeanFactory.getBean(adviceName);
        DefaultPointcutAdvisor a = new DefaultPointcutAdvisor(pc, advice);

        // Order advisors if necessary
        if (pc instanceof Ordered) {
          a.setOrder(((Ordered) pc).getOrder());
View Full Code Here

    // TODO should handle introductions also?
    if (pa != null && (pa instanceof PointcutAdvisor)) {
      String adviceName = aspectJAdviceMethod.getName();

      Advice advice = pa.getAdvice();

      // TODO this is required to cover named pointcuts, but seems a bit
      // hacky
      if (advice == null) {
        return;
View Full Code Here

      }
      return true;
    }

    private boolean equalsAdviceClasses(Advisor a, Advisor b) {
      Advice aa = a.getAdvice();
      Advice ba = b.getAdvice();
      if (aa == null || ba == null) {
        return (aa == ba);
      }
      return aa.getClass().equals(ba.getClass());
    }
View Full Code Here

    @Override
    public int hashCode() {
      int hashCode = 0;
      Advisor[] advisors = this.advised.getAdvisors();
      for (Advisor advisor : advisors) {
        Advice advice = advisor.getAdvice();
        if (advice != null) {
          hashCode = 13 * hashCode + advice.getClass().hashCode();
        }
      }
      hashCode = 13 * hashCode + (this.advised.isFrozen() ? 1 : 0);
      hashCode = 13 * hashCode + (this.advised.isExposeProxy() ? 1 : 0);
      hashCode = 13 * hashCode + (this.advised.isOptimize() ? 1 : 0);
View Full Code Here

TOP

Related Classes of org.aopalliance.aop.Advice

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.