Package org.springframework.binding.convert

Examples of org.springframework.binding.convert.ConversionService


    // targetClass is the correct one
    if ((sourceClass == null) || (sourceClass == targetClass)) {
      return sourceValueModel;
    }

    final ConversionService conversionService = getConversionService();
    ConversionExecutor convertTo = null;
    ConversionExecutor convertFrom = null;

    // Check for locally registered property converters
    if (propertyConversionServices.containsKey(formProperty)) {
      // TODO - extract ConfigurableConversionService interface...
      final GenericConversionService propertyConversionService = (GenericConversionService) propertyConversionServices
          .get(formProperty);

      if (propertyConversionService != null) {
        convertTo = propertyConversionService.getConversionExecutor(sourceClass, targetClass);
        convertFrom = propertyConversionService.getConversionExecutor(targetClass, sourceClass);
      }
    }

    // If we have nothing from the property level, then try the conversion
    // service
    if (convertTo == null) {
      convertTo = conversionService.getConversionExecutor(sourceClass, targetClass);
    }
    Assert.notNull(convertTo, "conversionService returned null ConversionExecutor");

    if (convertFrom == null) {
      convertFrom = conversionService.getConversionExecutor(targetClass, sourceClass);
    }
    Assert.notNull(convertFrom, "conversionService returned null ConversionExecutor");

    ValueModel convertingValueModel = preProcessNewConvertingValueModel(formProperty, targetClass,
        new TypeConverter(sourceValueModel, convertTo, convertFrom));
View Full Code Here

TOP

Related Classes of org.springframework.binding.convert.ConversionService

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.