New features
-
New option
konvert.enforce-not-null-strategyto define how Konvert handles mapping from nullable to non-nullable field #199 (thanks to @Shanzeee)ASSERTION_OPERATOR(default, deprecated) - uses the!!operator to assert that the source value is not null. Will result in a simpleNullPointerExceptionif the source value is null.REQUIRE_NOT_NULL- uses therequireNotNullfunction to check that the source value is not null. Will throw anIllegalArgumentExceptionwith a speaking message if the source value is null.
-
Three new type converters, which handle
Array<*>(including primitive arrays like e.g.IntArray) mappings:ArrayToArrayConverter- maps between arrays, e.g.Array<Int>toArray<String>ArrayToIterablesXConverter- maps from an array to an iterable, e.g.Array<Int>toList<String>IterableToArrayConverter- maps from an iterable to an array, e.g.List<Int>toArray<String>
The following example now works out-of-the-box and generates the appropriate mappings:
@KonvertTo(UserIdsDto::class) class UserIds(val ids: Array<Int>) @KonvertTo(UserIds::class) class UserIdsDto(val ids: List<Int>)
Improvements
-
Updates:
- Kotlin → 2.3.10
- KSP → 2.3.5
- Injectors (Anvil, Dagger, Koin, Spring)
-
Build updates:
- Gradle → 9.4.1
- Kotlin Compile Testing → 0.12.1
- jUnit → 6.0.2