Package org.aopalliance.aop

Examples of org.aopalliance.aop.Advice


        BeanOne proxyOne;
        BeanTwo proxyTwo;
       
        // create pointcut, advice and advisor
        Pointcut pc = new SimpleStaticPointcut();
        Advice advice = new SimpleAdvice();
        Advisor advisor = new DefaultPointcutAdvisor(pc, advice);
       
        // create BeanOne proxy
        ProxyFactory pf = new ProxyFactory();
        pf.addAdvisor(advisor);
View Full Code Here


      return this.advisor;
    }

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

      return (Advisor) adviceObject;
    }
    if (!(adviceObject instanceof Advice)) {
      throw new UnknownAdviceTypeException(adviceObject);
    }
    Advice advice = (Advice) adviceObject;
    if (advice instanceof MethodInterceptor) {
      // So well-known it doesn't even need an adapter.
      return new DefaultPointcutAdvisor(advice);
    }
    for (int i = 0; i < this.adapters.size(); i++) {
View Full Code Here

    throw new UnknownAdviceTypeException(advice);
  }

  public MethodInterceptor[] getInterceptors(Advisor advisor) throws UnknownAdviceTypeException {
    List interceptors = new ArrayList(3);
    Advice advice = advisor.getAdvice();
    if (advice instanceof MethodInterceptor) {
      interceptors.add(advice);
    }
    for (int i = 0; i < this.adapters.size(); i++) {
      AdvisorAdapter adapter = (AdvisorAdapter) this.adapters.get(i);
View Full Code Here

   */
  public static AspectJPrecedenceInformation getAspectJPrecedenceInformationFor(Advisor anAdvisor) {
    if (anAdvisor instanceof AspectJPrecedenceInformation) {
      return (AspectJPrecedenceInformation) anAdvisor;
    }
    Advice advice = anAdvisor.getAdvice();
    if (advice instanceof AspectJPrecedenceInformation) {
      return (AspectJPrecedenceInformation) advice;
    }
    return null;
  }
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

    public int hashCode() {
      int hashCode = 0;
      Advisor[] advisors = this.advised.getAdvisors();
      for (int i = 0; i < advisors.length; i++) {
        Advice advice = advisors[i].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

  }


  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

      }
      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.