Examples of ConverterNotFoundException


Examples of org.springframework.core.convert.ConverterNotFoundException

    if (targetType == TypeDescriptor.NULL) {
      return null;
    }
    GenericConverter converter = getConverter(sourceType, targetType);
    if (converter == null) {
      throw new ConverterNotFoundException(sourceType, targetType);
    }
    return ConversionUtils.invokeConverter(converter, source, sourceType, targetType);
  }
View Full Code Here

Examples of org.springframework.core.convert.ConverterNotFoundException

      if (source == null || targetType.getType().isInstance(source)) {
        logger.debug("No converter found - returning assignable source object as-is");
        return source;
      }
      else {
        throw new ConverterNotFoundException(sourceType, targetType);
      }
    }
    Object result = ConversionUtils.invokeConverter(converter, source, sourceType, targetType);
    if (logger.isDebugEnabled()) {
      logger.debug("Converted to " + StylerUtils.style(result));
View Full Code Here

Examples of org.springframework.core.convert.ConverterNotFoundException

        if (value != null) {
            ConversionService conversionService = (ConversionService) webRequest.getAttribute(ConversionService.class.getName(), WebRequest.SCOPE_REQUEST);
            if (conversionService.canConvert(value.getClass(), parameter.getParameterType())) {
                value = conversionService.convert(value, parameter.getParameterType());
            } else {
                throw new ConverterNotFoundException(TypeDescriptor.forObject(value), TypeDescriptor.valueOf(parameter.getParameterType()));
            }
        }
        //
        return value;
    }
View Full Code Here

Examples of org.springframework.core.convert.ConverterNotFoundException

            coffeeMachines.save(coffeeMachine);

            fail();
        } catch (MappingException me) {
            assertTrue("converter not found", me.getCause() instanceof ConverterNotFoundException);
            ConverterNotFoundException e = (ConverterNotFoundException) me.getCause();
            assertThat(asSet(DripBrew.class.getName(), EspressoBasedCoffee.class.getName()), hasItem(e.getSourceType().getName()));
            assertThat(asSet(DripBrew.class.getName(), EspressoBasedCoffee.class.getName()), hasItem(e.getTargetType().getName()));
            assertThat(e.getSourceType().getName(), is(not(equalTo(e.getTargetType().getName()))));
        }
    }
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.