From 9563f637fdb2d70ebfd74baffc26983549ebd390 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 14 Feb 2024 09:24:50 +0100 Subject: [PATCH] Document converter types supported by `CustomConversions`. Closes #3040 --- .../data/convert/CustomConversions.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/springframework/data/convert/CustomConversions.java b/src/main/java/org/springframework/data/convert/CustomConversions.java index a12b75702..f6d7bd3dd 100644 --- a/src/main/java/org/springframework/data/convert/CustomConversions.java +++ b/src/main/java/org/springframework/data/convert/CustomConversions.java @@ -55,7 +55,19 @@ import org.springframework.util.ObjectUtils; * Value object to capture custom conversion. That is essentially a {@link List} of converters and some additional logic * around them. The converters build up two sets of types which store-specific basic types can be converted into and * from. These types will be considered simple ones (which means they neither need deeper inspection nor nested - * conversion. Thus, the {@link CustomConversions} also act as factory for {@link SimpleTypeHolder} . + * conversion. Thus, the {@link CustomConversions} also act as factory for {@link SimpleTypeHolder}. + *

+ * Custom conversions supports the following converters: + *

+ * Note that CustomConversions does not support {@link org.springframework.core.convert.converter.ConditionalConverter} + * as custom conversions maintains a registry of convertible type pairs; We cannot determine convertible types based on + * {@code ConditionalConverter#matches}, instead, we require a converter to provide its convertible types either through + * the class declaration or {@code GenericConverter#getConvertibleTypes}. * * @author Oliver Gierke * @author Thomas Darimont @@ -119,9 +131,9 @@ public class CustomConversions { List registeredConverters = collectPotentialConverterRegistrations( converterConfiguration.getStoreConversions(), converterConfiguration.getUserConverters()).stream() - .filter(this::isSupportedConverter).filter(this::shouldRegister) - .map(ConverterRegistrationIntent::getConverterRegistration).map(this::register).distinct() - .collect(Collectors.toList()); + .filter(this::isSupportedConverter).filter(this::shouldRegister) + .map(ConverterRegistrationIntent::getConverterRegistration).map(this::register).distinct() + .collect(Collectors.toList()); Collections.reverse(registeredConverters);