Package org.springframework.aop

Examples of org.springframework.aop.Advisor


        proxyFactory.addAdvisor(this.advisorAdapterRegistry.wrap(this.preInterceptors[i]));
      }
    }

    if (this.pointcut != null) {
      Advisor advice = new DefaultPointcutAdvisor(this.pointcut, this.resourceInterceptor);
      proxyFactory.addAdvisor(advice);
    }
    else {
      // rely on default pointcut
      proxyFactory.addAdvisor(new ResourceAdvisor(this.resourceInterceptor));
View Full Code Here


    factoryBean.afterPropertiesSet();

    Advised advised = (Advised) factoryBean.getProxy();
    Advisor[] advisors = advised.getAdvisors();
    assertEquals(2, advisors.length);
    Advisor advisor1 = advisors[0];
    Advisor advisor2 = advisors[1];

    if (advisor1 instanceof CachingModelSourceAdvisor) {
      assertEquals(FlushingModelSourceAdvisor.class, advisor2.getClass());

    } else if (advisor1 instanceof FlushingModelSourceAdvisor) {
      assertEquals(CachingModelSourceAdvisor.class, advisor2.getClass());

    } else {
      fail("Expected: <" + CachingModelSourceAdvisor.class.getName() + "> or <"
          + FlushingModelSourceAdvisor.class.getName() + "> but was: <"
          + advisor1.getClass().getName() + ">");
View Full Code Here

        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);
        pf.setTarget(one);
View Full Code Here

    public static void main(String[] args) {
        SampleBean target = new SampleBean();

        // create advisor
        Advisor advisor = new DefaultPointcutAdvisor(
                new SimpleDynamicPointcut(), new SimpleAdvice());
       
        // create proxy
        ProxyFactory pf = new ProxyFactory();
        pf.setTarget(target);
View Full Code Here

public class ProxyPerfTest {

    public static void main(String[] args) {
        ISimpleBean target = new SimpleBean();

        Advisor advisor = new DefaultPointcutAdvisor(new TestPointcut(),
                new NoOpBeforeAdvice());

        runCglibTests(advisor, target);
        runCglibFrozenTests(advisor, target);
        runJdkTests(advisor, target);
View Full Code Here

        // create advisor
        NameMatchMethodPointcut pc = new NameMatchMethodPointcut();
        pc.addMethodName("foo");
        pc.addMethodName("bar");
        Advisor advisor = new DefaultPointcutAdvisor(pc, new SimpleAdvice());
       
        // create the proxy
        ProxyFactory pf = new ProxyFactory();
        pf.setTarget(target);
        pf.addAdvisor(advisor);
View Full Code Here

        RegexpBean target = new RegexpBean();
       
        // create the advisor
        JdkRegexpMethodPointcut pc = new JdkRegexpMethodPointcut();
        pc.setPattern(".*foo.*");
        Advisor advisor = new DefaultPointcutAdvisor(pc, new SimpleAdvice());
       
        // create the proxy
        ProxyFactory pf = new ProxyFactory();
        pf.setTarget(target);
        pf.addAdvisor(advisor);
View Full Code Here

    public void run() {
        TestBean target = new TestBean();

        // create advisor
        Pointcut pc = new ControlFlowPointcut(ControlFlowExample.class, "test");
        Advisor advisor = new DefaultPointcutAdvisor(pc,
                new SimpleBeforeAdvice());

        // create proxy
        ProxyFactory pf = new ProxyFactory();
        pf.setTarget(target);
View Full Code Here

    }

    private static SampleBean getProxy(ComposablePointcut pc, SampleBean target) {
        // create the advisor

        Advisor advisor = new DefaultPointcutAdvisor(pc,
                new SimpleBeforeAdvice());

        // create the proxy
        ProxyFactory pf = new ProxyFactory();
        pf.setTarget(target);
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

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.