Examples of canConvert()


Examples of org.springframework.expression.TypeConverter.canConvert()

   */
  private static String convertTypedValueToString(TypedValue value, ExpressionState state) {
    final TypeConverter typeConverter = state.getEvaluationContext().getTypeConverter();
    final TypeDescriptor typeDescriptor = TypeDescriptor.valueOf(String.class);

    if (typeConverter.canConvert(value.getTypeDescriptor(), typeDescriptor)) {
      final Object obj = typeConverter.convertValue(value.getValue(), value.getTypeDescriptor(), typeDescriptor);
      return String.valueOf(obj);
    } else {
      return String.valueOf(value.getValue());
    }
View Full Code Here

Examples of org.springframework.expression.TypeConverter.canConvert()

   * @return {@code TypedValue} instance converted to {@code String}
   */
  private static String convertTypedValueToString(TypedValue value, ExpressionState state) {
    TypeConverter typeConverter = state.getEvaluationContext().getTypeConverter();
    TypeDescriptor typeDescriptor = TypeDescriptor.valueOf(String.class);
    if (typeConverter.canConvert(value.getTypeDescriptor(), typeDescriptor)) {
      return String.valueOf(typeConverter.convertValue(value.getValue(),
          value.getTypeDescriptor(), typeDescriptor));
    }
    return String.valueOf(value.getValue());
  }
View Full Code Here

Examples of org.springframework.format.support.DefaultFormattingConversionService.canConvert()

    DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService();
    conversionService.addConverter(UUIDConverter.INSTANCE);
    configureConversionService(conversionService);

    if (!conversionService.canConvert(String.class, Point.class)) {
      conversionService.addConverter(StringToPointConverter.INSTANCE);
    }

    if (!conversionService.canConvert(String.class, Distance.class)) {
      conversionService.addConverter(StringToDistanceConverter.INSTANCE);
View Full Code Here

Examples of org.springframework.format.support.DefaultFormattingConversionService.canConvert()

    if (!conversionService.canConvert(String.class, Point.class)) {
      conversionService.addConverter(StringToPointConverter.INSTANCE);
    }

    if (!conversionService.canConvert(String.class, Distance.class)) {
      conversionService.addConverter(StringToDistanceConverter.INSTANCE);
    }

    return conversionService;
  }
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.