Package org.springframework.aop.framework

Examples of org.springframework.aop.framework.ProxyFactory.addInterface()


     * @return
     */
    protected Object getProxyForService()
    {
        ProxyFactory proxyFactory = new ProxyFactory();
        proxyFactory.addInterface(getXFireService().getServiceInfo().getServiceClass());

        proxyFactory.setTarget(getServiceBean());
        return proxyFactory.getProxy();
    }
   
View Full Code Here


    if (!shouldProxyTargetClass(beanClass, beanName)) {
      // Must allow for introductions; can't just set interfaces to
      // the target's interfaces only.
      Class[] targetInterfaces = ClassUtils.getAllInterfacesForClass(beanClass, this.beanClassLoader);
      for (int i = 0; i < targetInterfaces.length; i++) {
        proxyFactory.addInterface(targetInterfaces[i]);
      }
    }

    Advisor[] advisors = buildAdvisors(beanName, specificInterceptors);
    for (int i = 0; i < advisors.length; i++) {
View Full Code Here

    if (!shouldProxyTargetClass(beanClass, beanName)) {
      // Must allow for introductions; can't just set interfaces to
      // the target's interfaces only.
      Class<?>[] targetInterfaces = ClassUtils.getAllInterfacesForClass(beanClass, this.proxyClassLoader);
      for (Class<?> targetInterface : targetInterfaces) {
        proxyFactory.addInterface(targetInterface);
      }
    }

    Advisor[] advisors = buildAdvisors(beanName, specificInterceptors);
    for (Advisor advisor : advisors) {
View Full Code Here

  }

  public void testWithInterface() {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setTarget(new TestWithInterfaceImpl());
    proxyFactory.addInterface(TestWithInterface.class);
    proxyFactory.addAdvice(this.ti);

    TestWithInterface proxy = (TestWithInterface) proxyFactory.getProxy();

    proxy.doSomething();
View Full Code Here

  }

  public void testCrossClassInterfaceMethodLevelOnJdkProxy() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setTarget(new SomeServiceImpl());
    proxyFactory.addInterface(SomeService.class);
    proxyFactory.addAdvice(this.ti);

    SomeService someService = (SomeService) proxyFactory.getProxy();

    someService.bar();
View Full Code Here

  }

  public void testCrossClassInterfaceOnJdkProxy() throws Exception {
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setTarget(new OtherServiceImpl());
    proxyFactory.addInterface(OtherService.class);
    proxyFactory.addAdvice(this.ti);

    OtherService otherService = (OtherService) proxyFactory.getProxy();

    otherService.foo();
View Full Code Here

  }

  @Test
  public void testProxyWithNoTarget() throws Exception {
    ProxyFactory factory = new ProxyFactory();
    factory.addInterface(DataSource.class);
    factory.addAdvice(new MethodInterceptor() {
      @Override
      public Object invoke(MethodInvocation invocation) throws Throwable {
        return null;
      }
View Full Code Here

      pointcut.addMethodName("receiveAndExecute");
      advisor.setPointcut(pointcut);
      factory.addAdvisor(advisor);
    }
    factory.setProxyTargetClass(false);
    factory.addInterface(ContainerDelegate.class);
    factory.setTarget(delegate);
    proxy = (ContainerDelegate) factory.getProxy();
  }

}
View Full Code Here

    }

    ProxyFactory proxyFactory = new ProxyFactory();

    for (Class<?> type : propertyType.getInterfaces()) {
      proxyFactory.addInterface(type);
    }

    proxyFactory.addInterface(LazyLoadingProxy.class);
    proxyFactory.addInterface(propertyType);
    proxyFactory.addAdvice(interceptor);
View Full Code Here

    for (Class<?> type : propertyType.getInterfaces()) {
      proxyFactory.addInterface(type);
    }

    proxyFactory.addInterface(LazyLoadingProxy.class);
    proxyFactory.addInterface(propertyType);
    proxyFactory.addAdvice(interceptor);

    return handler.populateId(property, dbref, proxyFactory.getProxy());
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.