Skip to content

Commit 6bcff26

Browse files
committed
Document converter types supported by CustomConversions.
Closes #3040
1 parent 6e78e66 commit 6bcff26

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Diff for: src/main/java/org/springframework/data/convert/CustomConversions.java

+16-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,19 @@
5555
* Value object to capture custom conversion. That is essentially a {@link List} of converters and some additional logic
5656
* around them. The converters build up two sets of types which store-specific basic types can be converted into and
5757
* from. These types will be considered simple ones (which means they neither need deeper inspection nor nested
58-
* conversion. Thus, the {@link CustomConversions} also act as factory for {@link SimpleTypeHolder} .
58+
* conversion. Thus, the {@link CustomConversions} also act as factory for {@link SimpleTypeHolder}.
59+
* <p>
60+
* Custom conversions supports the following converters:
61+
* <ul>
62+
* <li>Converters built by {@link ConverterBuilder}</li>
63+
* <li>{@link GenericConverter}</li>
64+
* <li>{@link ConverterFactory}</li>
65+
* <li>{@link Converter}</li>
66+
* </ul>
67+
* Note that CustomConversions does not support {@link org.springframework.core.convert.converter.ConditionalConverter}
68+
* as custom conversions maintains a registry of convertible type pairs; We cannot determine convertible types based on
69+
* {@code ConditionalConverter#matches}, instead, we require a converter to provide its convertible types either through
70+
* the class declaration or {@code GenericConverter#getConvertibleTypes}.
5971
*
6072
* @author Oliver Gierke
6173
* @author Thomas Darimont
@@ -119,9 +131,9 @@ public CustomConversions(ConverterConfiguration converterConfiguration) {
119131

120132
List<Object> registeredConverters = collectPotentialConverterRegistrations(
121133
converterConfiguration.getStoreConversions(), converterConfiguration.getUserConverters()).stream()
122-
.filter(this::isSupportedConverter).filter(this::shouldRegister)
123-
.map(ConverterRegistrationIntent::getConverterRegistration).map(this::register).distinct()
124-
.collect(Collectors.toList());
134+
.filter(this::isSupportedConverter).filter(this::shouldRegister)
135+
.map(ConverterRegistrationIntent::getConverterRegistration).map(this::register).distinct()
136+
.collect(Collectors.toList());
125137

126138
Collections.reverse(registeredConverters);
127139

0 commit comments

Comments
 (0)