Also: SpringCore
public interface

ConversionService

org.springframework.core.convert.ConversionService
Known Indirect Subclasses

Class Overview

A service interface for type conversion. This is the entry point into the convert system. Call convert(Object, Class) to perform a thread-safe type conversion using this system.

Summary

Public Methods
abstract boolean canConvert(TypeDescriptor sourceType, TypeDescriptor targetType)
Returns true if objects of sourceType can be converted to the targetType.
abstract boolean canConvert(Class<?> sourceType, Class<?> targetType)
Returns true if objects of sourceType can be converted to targetType.
abstract <T> T convert(Object source, Class<T> targetType)
Convert the source to targetType.
abstract Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
Convert the source to targetType.

Public Methods

public abstract boolean canConvert (TypeDescriptor sourceType, TypeDescriptor targetType)

Also: SpringCore

Returns true if objects of sourceType can be converted to the targetType. The TypeDescriptors provide additional context about the field locations where conversion would occur, often object property locations. This flavor of the canConvert operation exists mainly for use by a general purpose data mapping framework, and not for use by user code.

Parameters
sourceType context about the source type to convert from (required)
targetType context about the target type to convert to (required)
Returns
  • true if a conversion can be performed between the source and target types, false if not

public abstract boolean canConvert (Class<?> sourceType, Class<?> targetType)

Also: SpringCore

Returns true if objects of sourceType can be converted to targetType.

Parameters
sourceType the source type to convert from (required)
targetType the target type to convert to (required)
Returns
  • true if a conversion can be performed, false if not

public abstract T convert (Object source, Class<T> targetType)

Also: SpringCore

Convert the source to targetType.

Parameters
source the source object to convert (may be null)
targetType the target type to convert to (required)
Returns
  • the converted object, an instance of targetType
Throws
ConversionException if an exception occurred

public abstract Object convert (Object source, TypeDescriptor sourceType, TypeDescriptor targetType)

Also: SpringCore

Convert the source to targetType. The TypeDescriptors provide additional context about the field locations where conversion will occur, often object property locations. This flavor of the convert operation exists mainly for use by a general purpose data mapping framework, and not for use by user code.

Parameters
source the source object to convert (may be null)
sourceType context about the source type converting from (required)
targetType context about the target type to convert to (required)
Returns
Throws
ConversionException if an exception occurred