Package org.springframework.core.convert.support

Examples of org.springframework.core.convert.support.GenericConversionService


    throw new UnsupportedOperationException();
  }

  private void initBeanWrapper(BeanWrapperImpl beanWrapper) {

    GenericConversionService conversionService = new GenericConversionService();
    conversionService.addConverter(new MultipartFileConverter(beanWrapper));

    beanWrapper.setConversionService(conversionService);
    if (beanFactory != null) {
      beanFactory.copyRegisteredEditorsTo(beanWrapper);
    }
View Full Code Here


  }

  @Test
  public void populatesConversionServiceCorrectly() {

    GenericConversionService conversionService = new DefaultConversionService();

    CustomConversions conversions = new CustomConversions(Arrays.asList(StringToFormatConverter.INSTANCE));
    conversions.registerConvertersIn(conversionService);

    assertThat(conversionService.canConvert(String.class, Format.class), is(true));
  }
View Full Code Here

   */
  @Test
  public void customConverterOverridesDefault() {

    CustomConversions conversions = new CustomConversions(Arrays.asList(CustomDateTimeConverter.INSTANCE));
    GenericConversionService conversionService = new DefaultConversionService();
    conversions.registerConvertersIn(conversionService);

    assertThat(conversionService.convert(new DateTime(), Date.class), is(new Date(0)));
  }
View Full Code Here

   * Create a new {@link RelaxedConversionService} instance.
   * @param conversionService and option root conversion service
   */
  public RelaxedConversionService(ConversionService conversionService) {
    this.conversionService = conversionService;
    this.additionalConverters = new GenericConversionService();
    this.additionalConverters
        .addConverterFactory(new StringToEnumIgnoringCaseConverterFactory());
    this.additionalConverters.addConverter(new StringToCharArrayConverter());
  }
View Full Code Here

  @Before
  public void setUp() {

    context = new GemfireMappingContext();
    conversionService = new GenericConversionService();
    serializer = new MappingPdxSerializer(context, conversionService);
    Map<Class<?>,PdxSerializer> customSerializers = new HashMap<Class<?>, PdxSerializer>();
    customSerializers.put(Address.class, addressSerializer);
    serializer.setCustomSerializers(customSerializers);
  }
View Full Code Here

    }

  @InitBinder
    void registerConverters(WebDataBinder binder) {
        if (binder.getConversionService() instanceof GenericConversionService) {
            GenericConversionService conversionService = (GenericConversionService) binder.getConversionService();
            conversionService.addConverter(getRestaurantConverter());
            conversionService.addConverter(getUserAccountConverter());
            conversionService.addConverter(getRestaurantConverterFromString());
        }
    }
View Full Code Here

        private final PropertyConverter propertyConverter;

        public GenericNodePropertyFieldAccessor(Neo4jPersistentProperty property,
                                                Neo4jTemplate template) {
            super(template, property);
            GenericConversionService genericConversionService = new GenericConversionService();
            genericConversionService.addConverter(new GenericObjectToObjectConverter());
            this.propertyConverter = new PropertyConverter(genericConversionService,property);
        }
View Full Code Here

public class Neo4jConversionServiceFactoryBean implements FactoryBean<ConversionService> {

    @Override
    public ConversionService getObject() throws Exception {
        GenericConversionService conversionService = new GenericConversionService();
        addConverters(conversionService);
        DefaultConversionService.addDefaultConverters(conversionService);
        return conversionService;
    }
View Full Code Here

    }

  @InitBinder
    void registerConverters(WebDataBinder binder) {
        if (binder.getConversionService() instanceof GenericConversionService) {
            GenericConversionService conversionService = (GenericConversionService) binder.getConversionService();
            conversionService.addConverter(getRestaurantConverter());
            conversionService.addConverter(getUserAccountConverter());
            conversionService.addConverter(getRestaurantConverterFromString());
        }
    }
View Full Code Here


  @InitBinder
    void registerConverters(WebDataBinder binder) {
        if (binder.getConversionService() instanceof GenericConversionService) {
            GenericConversionService conversionService = (GenericConversionService) binder.getConversionService();
            conversionService.addConverter(getRestaurantConverter());
        }
    }
View Full Code Here

TOP

Related Classes of org.springframework.core.convert.support.GenericConversionService

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.