Package org.springframework.beans

Examples of org.springframework.beans.ConfigurablePropertyAccessor


    assertEquals(new LocalDate(2009, 10, 31), new LocalDate(dates.get(0)));
    assertEquals(new LocalDate(2009, 11, 1), new LocalDate(dates.get(1)));
    assertEquals(new LocalDate(2009, 11, 2), new LocalDate(dates.get(2)));

    Object model = BeanUtils.instantiate(modelClass);
    ConfigurablePropertyAccessor accessor = directFieldAccess ? PropertyAccessorFactory.forDirectFieldAccess(model) :
        PropertyAccessorFactory.forBeanPropertyAccess(model);
    accessor.setConversionService(formattingService);
    accessor.setPropertyValue("dates", "10-31-09,11-1-09,11-2-09");
    dates = (List<Date>) accessor.getPropertyValue("dates");
    assertEquals(new LocalDate(2009, 10, 31), new LocalDate(dates.get(0)));
    assertEquals(new LocalDate(2009, 11, 1), new LocalDate(dates.get(1)));
    assertEquals(new LocalDate(2009, 11, 2), new LocalDate(dates.get(2)));
    if (!directFieldAccess) {
      accessor.setPropertyValue("dates[0]", "10-30-09");
      accessor.setPropertyValue("dates[1]", "10-1-09");
      accessor.setPropertyValue("dates[2]", "10-2-09");
      dates = (List<Date>) accessor.getPropertyValue("dates");
      assertEquals(new LocalDate(2009, 10, 30), new LocalDate(dates.get(0)));
      assertEquals(new LocalDate(2009, 10, 1), new LocalDate(dates.get(1)));
      assertEquals(new LocalDate(2009, 10, 2), new LocalDate(dates.get(2)));
    }
  }
View Full Code Here


        configureRepositories(repositories);
        return repositories;
    }

    private Repositories configureRepositories(Repositories repositories) {
        ConfigurablePropertyAccessor configurablePropertyAccessor = forDirectFieldAccess(repositories);
        ListableBeanFactory beanFactory = (ListableBeanFactory) getBeanFactory();
        configurablePropertyAccessor.setPropertyValue("beanFactory", beanFactory);
        configurablePropertyAccessor.setPropertyValue("repositoryBeanNames", repositoryBeanNames(beanFactory));
        configurablePropertyAccessor.setPropertyValue("repositoryFactoryInfos", repositoryFactoryInfos(beanFactory));
        return repositories;
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.ConfigurablePropertyAccessor

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.