org.springframework.core.convert.converter
Interface Converter<S,T>
-
- Type Parameters:
-
S
- The source type -
T
- The target type
- All Known Implementing Classes:
- DeserializingConverter, SerializingConverter
public interface Converter<S,T>
A converter converts a source object of type S to a target of type T. Implementations of this interface are thread-safe and can be shared.Implementations may additionally implement
ConditionalConverter
.- Since:
- 3.0
- Author:
- Keith Donald
- See Also:
-
ConditionalConverter
-
Method Detail
convert
T convert(S source)
Convert the source of type S to target type T.- Parameters:
-
source
- the source object to convert, which must be an instance of S - Returns:
- the converted object, which must be an instance of T
- Throws:
-
IllegalArgumentException
- if the source could not be converted to the desired target type