mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-25 16:29:28 +00:00
Fix type conversion example
This commit is contained in:
@@ -316,9 +316,11 @@ Java::
|
||||
|
||||
List<Integer> input = ...
|
||||
cs.convert(input,
|
||||
TypeDescriptor.forObject(input), // List<Integer> type descriptor
|
||||
TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(String.class)));
|
||||
TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(Integer.class)), // <1>
|
||||
TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(String.class))); // <2>
|
||||
----
|
||||
<1> `List<Integer>` type descriptor
|
||||
<2> `List<String>` type descriptor
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
@@ -328,9 +330,11 @@ Kotlin::
|
||||
|
||||
val input: List<Integer> = ...
|
||||
cs.convert(input,
|
||||
TypeDescriptor.forObject(input), // List<Integer> type descriptor
|
||||
TypeDescriptor.collection(List::class.java, TypeDescriptor.valueOf(String::class.java)))
|
||||
TypeDescriptor.collection(List::class.java, TypeDescriptor.valueOf(Integer::class.java)), // <1>
|
||||
TypeDescriptor.collection(List::class.java, TypeDescriptor.valueOf(String::class.java))) // <2>
|
||||
----
|
||||
<1> `List<Integer>` type descriptor
|
||||
<2> `List<String>` type descriptor
|
||||
======
|
||||
|
||||
Note that `DefaultConversionService` automatically registers converters that are
|
||||
|
||||
Reference in New Issue
Block a user