Package org.springframework.format.support

Examples of org.springframework.format.support.FormattingConversionServiceFactoryBean


     * 获取默认的格式化转换器
     *
     * @return
     */
    private FormattingConversionService getDefaultConversionService() {
        FormattingConversionServiceFactoryBean serviceFactoryBean = new FormattingConversionServiceFactoryBean();
        serviceFactoryBean.afterPropertiesSet();
        return serviceFactoryBean.getObject();
    }
View Full Code Here


  /**
   * Default constructor.
   */
  public GenericConversionService() {
    FormattingConversionServiceFactoryBean factoryBean = new FormattingConversionServiceFactoryBean();
    factoryBean.afterPropertiesSet();
    this.delegate = factoryBean.getObject();
  }
View Full Code Here

     * 获取默认的格式化转换器
     *
     * @return
     */
    private FormattingConversionService getDefaultConversionService() {
        FormattingConversionServiceFactoryBean serviceFactoryBean = new FormattingConversionServiceFactoryBean();
        serviceFactoryBean.afterPropertiesSet();
        return serviceFactoryBean.getObject();
    }
View Full Code Here

*/
public class FormattingConversionServiceTest {

    @Test
    public void testDoBind() {
        FormattingConversionServiceFactoryBean serviceFactoryBean = new FormattingConversionServiceFactoryBean();
        Set<Object> converters = new HashSet<Object>();
        converters.add(new RopRequestMessageConverter());
        serviceFactoryBean.setConverters(converters);

        serviceFactoryBean.afterPropertiesSet();
        ConversionService conversionService = serviceFactoryBean.getObject();
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setParameter("userName", "tom");
        request.setParameter("address",
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                        "<address zoneCode=\"1\" doorCode=\"002\">\n" +
View Full Code Here

  private MockPageContext context;

  @Override
  protected void setUp() throws Exception {
    context = createPageContext();
    FormattingConversionServiceFactoryBean factory = new FormattingConversionServiceFactoryBean();
    factory.afterPropertiesSet();
    context.getRequest().setAttribute("org.springframework.core.convert.ConversionService", factory.getObject());
    context.getRequest().setAttribute("bean", new Bean());
    tag = new EvalTag();
    tag.setPageContext(context);
  }
View Full Code Here

    assertHasBean(this.applicationContext, GenericFacesConverter.class);
  }

  @Test
  public void shouldLoadConverter() throws Exception {
    FormattingConversionServiceFactoryBean bean = this.applicationContext
        .getBean(FormattingConversionServiceFactoryBean.class);
    FormattingConversionService conversionService = bean.getObject();
    TypeDescriptor targetType = TypeDescriptor.valueOf(ClassWithConverter.class);
    assertThat(conversionService.convert(this.source, this.sourceType, targetType), is(equalTo(this.converted)));
  }
View Full Code Here

TOP

Related Classes of org.springframework.format.support.FormattingConversionServiceFactoryBean

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.