2424
2525/**
2626 * A service interface for type conversion. This is the entry point into the convert system.
27- * Call {@link #convert(Object, Class)} to perform a thread-safe type conversion using this system.
27+ * Call {@link #convert(Object, Class, Locale)} to perform a thread-safe type conversion using this
28+ * system.
2829 *
2930 * @author Keith Donald
3031 * @author Phillip Webb
@@ -51,7 +52,7 @@ public interface ConversionService {
5152 * Return {@code true} if objects of {@code sourceType} can be converted to the {@code targetType}.
5253 * The TypeDescriptors provide additional context about the source and target locations
5354 * where conversion would occur, often object fields or property locations.
54- * <p>If this method returns {@code true}, it means {@link #convert(Object, TypeDescriptor, TypeDescriptor)}
55+ * <p>If this method returns {@code true}, it means {@link #convert(Object, TypeDescriptor, TypeDescriptor, Locale )}
5556 * is capable of converting an instance of {@code sourceType} to {@code targetType}.
5657 * <p>Special note on collections, arrays, and maps types:
5758 * For conversion between collection, array, and map types, this method will return {@code true}
@@ -71,6 +72,7 @@ public interface ConversionService {
7172 * Convert the given {@code source} to the specified {@code targetType}.
7273 * @param source the source object to convert (may be {@code null})
7374 * @param targetType the target type to convert to (required)
75+ * @param locale the locale to use while converting
7476 * @return the converted object, an instance of targetType
7577 * @throws ConversionException if a conversion exception occurred
7678 * @throws IllegalArgumentException if targetType is {@code null}
@@ -79,11 +81,12 @@ public interface ConversionService {
7981
8082 /**
8183 * Convert the given {@code source} to the specified {@code targetType}.
82- * <p>Delegates to {@link #convert(Object, TypeDescriptor, TypeDescriptor)}
84+ * <p>Delegates to {@link #convert(Object, TypeDescriptor, TypeDescriptor, Locale )}
8385 * and encapsulates the construction of the source type descriptor using
8486 * {@link TypeDescriptor#forObject(Object)}.
8587 * @param source the source object
8688 * @param targetType the target type
89+ * @param locale the locale to use while converting
8790 * @return the converted value
8891 * @throws ConversionException if a conversion exception occurred
8992 * @throws IllegalArgumentException if targetType is {@code null}
@@ -100,6 +103,7 @@ default Object convert(Object source, TypeDescriptor targetType, Locale locale)
100103 * @param sourceType context about the source type to convert from
101104 * (may be {@code null} if source is {@code null})
102105 * @param targetType context about the target type to convert to (required)
106+ * @param locale the locale to use while converting
103107 * @return the converted object, an instance of {@link TypeDescriptor#getObjectType() targetType}
104108 * @throws ConversionException if a conversion exception occurred
105109 * @throws IllegalArgumentException if targetType is {@code null},
0 commit comments