Package org.springframework.core.convert.support

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


  private static RepositoryInvoker getInvokerFor(Object repository, VerifyingMethodInterceptor interceptor) {

    Object proxy = getVerifyingRepositoryProxy(repository, interceptor);

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(repository.getClass().getInterfaces()[0]);
    GenericConversionService conversionService = new DefaultFormattingConversionService();

    return new CrudRepositoryInvoker((CrudRepository) proxy, metadata, conversionService);
  }
View Full Code Here


  }

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

  @SuppressWarnings({ "unchecked", "rawtypes" })
  private static RepositoryInvoker getInvokerFor(Object repository) {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(repository.getClass().getInterfaces()[0]);
    GenericConversionService conversionService = new DefaultFormattingConversionService();

    return new PagingAndSortingRepositoryInvoker((PagingAndSortingRepository) repository, metadata, conversionService);
  }
View Full Code Here

  }

  private static RepositoryInvoker getInvokerFor(Object repository) {

    RepositoryMetadata metadata = new DefaultRepositoryMetadata(repository.getClass().getInterfaces()[0]);
    GenericConversionService conversionService = new DefaultFormattingConversionService();

    return new ReflectionRepositoryInvoker(repository, metadata, conversionService);
  }
View Full Code Here

        if(autowireCapableBeanFactory instanceof ConfigurableListableBeanFactory) {
            ConfigurableListableBeanFactory beanFactory = (ConfigurableListableBeanFactory)autowireCapableBeanFactory;
            ConversionService existingConversionService = beanFactory.getConversionService();
            ConverterRegistry converterRegistry;
            if(existingConversionService == null) {
                GenericConversionService conversionService = new GenericConversionService();
                converterRegistry = conversionService;
                beanFactory.setConversionService(conversionService);
            }
            else {
                converterRegistry = (ConverterRegistry)existingConversionService;
View Full Code Here

{

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

  @Configuration
  public static class Config {

    @Bean
    public ConversionService webSocketConversionService() {
      GenericConversionService conversionService = new DefaultConversionService();
      conversionService.addConverter(new MyTypeToStringConverter());
      conversionService.addConverter(new MyTypeToBytesConverter());
      conversionService.addConverter(new StringToMyTypeConverter());
      conversionService.addConverter(new BytesToMyTypeConverter());
      return conversionService;
    }
View Full Code Here

  @Configuration
  public static class NoConvertersConfig {

    @Bean
    public ConversionService webSocketConversionService() {
      return new GenericConversionService();
    }
View Full Code Here

  @Test
  public void prototypeCreationReevaluatesExpressions() {
    GenericApplicationContext ac = new GenericApplicationContext();
    AnnotationConfigUtils.registerAnnotationConfigProcessors(ac);
    GenericConversionService cs = new GenericConversionService();
    cs.addConverter(String.class, String.class, new Converter<String, String>() {
      @Override
      public String convert(String source) {
        return source.trim();
      }
    });
View Full Code Here

  @Test
  public void testNullNestedTypeDescriptorWithBadConversionService() {
    Foo foo = new Foo();
    BeanWrapperImpl wrapper = new BeanWrapperImpl(foo);
    wrapper.setConversionService(new GenericConversionService() {
      @Override
      public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
        throw new ConversionFailedException(sourceType, targetType, source, null);
      }
    });
View Full Code Here

TOP

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

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.