Package org.springframework.core.convert

Examples of org.springframework.core.convert.ConverterNotFoundException


      return source;
    }
    if (sourceType.isAssignableTo(targetType) && targetType.getObjectType().isInstance(source)) {
      return source;
    }
    throw new ConverterNotFoundException(sourceType, targetType);
  }
View Full Code Here


      target.add(source);
    }
    else {
      GenericConverter converter = this.conversionService.getConverter(sourceType, targetElementType);
      if (converter == null) {
        throw new ConverterNotFoundException(sourceType, targetElementType);
      }
      target.add(ConversionUtils.invokeConverter(converter, source, sourceType, targetElementType));
    }
    return target;
  }
View Full Code Here

    }
    else {
      Object target = Array.newInstance(targetElementType.getType(), fields.length);
      GenericConverter converter = this.conversionService.getConverter(sourceType, targetElementType);
      if (converter == null) {
        throw new ConverterNotFoundException(sourceType, targetElementType);
      }
      for (int i = 0; i < fields.length; i++) {
        Array.set(target, i, ConversionUtils.invokeConverter(converter, fields[i], sourceType, targetElementType));
      }
      return target;
View Full Code Here

      Array.set(target, 0, source);
    }
    else {
      GenericConverter converter = this.conversionService.getConverter(sourceType, targetElementType);
      if (converter == null) {
        throw new ConverterNotFoundException(sourceType, targetElementType);
      }
      Array.set(target, 0, ConversionUtils.invokeConverter(converter, source, sourceType, targetElementType));
    }
    return target;
  }
View Full Code Here

      }
    }
    else {
      GenericConverter converter = this.conversionService.getConverter(sourceElementType, targetElementType);
      if (converter == null) {
        throw new ConverterNotFoundException(sourceElementType, targetElementType);
      }
      for (Iterator<?> it = sourceCollection.iterator(); it.hasNext(); i++) {
        Object sourceElement = it.next();
        Object targetElement = ConversionUtils.invokeConverter(
            converter, sourceElement, sourceElementType, targetElementType);
View Full Code Here

      }
    }
    else {
      GenericConverter converter = this.conversionService.getConverter(sourceElementType, targetElementType);
      if (converter == null) {
        throw new ConverterNotFoundException(sourceElementType, targetElementType);
      }
      for (int i = 0; i < length; i++) {
        Object sourceElement = Array.get(source, i);
        Object targetElement = ConversionUtils.invokeConverter(
            converter, sourceElement, sourceElementType, targetElementType);
View Full Code Here

      }
    }
    else {
      GenericConverter converter = this.conversionService.getConverter(sourceType, targetElementType);
      if (converter == null) {
        throw new ConverterNotFoundException(sourceType, targetElementType);
      }
      for (String sourceElement : fields) {
        Object targetElement = ConversionUtils.invokeConverter(
            converter, sourceElement, sourceType, targetElementType);
        target.add(targetElement);
View Full Code Here

        return firstElement;
      }
      else {
        GenericConverter converter = this.conversionService.getConverter(sourceElementType, targetType);
        if (converter == null) {
          throw new ConverterNotFoundException(sourceElementType, targetType);
        }
        return ConversionUtils.invokeConverter(converter, firstElement, sourceElementType, targetType);
      }
    }
  }
View Full Code Here

    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

      boolean valuesCompatible, GenericConversionService conversionService) {

    if (sourceKeyType != TypeDescriptor.NULL && targetKeyType != TypeDescriptor.NULL && !keysCompatible) {
      this.keyConverter = conversionService.getConverter(sourceKeyType, targetKeyType);
      if (this.keyConverter == null) {
        throw new ConverterNotFoundException(sourceKeyType, targetKeyType);
      }
      this.sourceKeyType = sourceKeyType;
      this.targetKeyType = targetKeyType;
    }

    if (sourceValueType != TypeDescriptor.NULL && targetValueType != TypeDescriptor.NULL && !valuesCompatible) {
      this.valueConverter = conversionService.getConverter(sourceValueType, targetValueType);
      if (this.valueConverter == null) {
        throw new ConverterNotFoundException(sourceValueType, targetValueType);
      }
      this.sourceValueType = sourceValueType;
      this.targetValueType = targetValueType;
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.core.convert.ConverterNotFoundException

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.