Skip to content

Commit fe120ed

Browse files
committed
Documentation
1 parent ea8354e commit fe120ed

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

CHANGELOG.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ worked to make these changes as minimal as possible.
2828
### Adoption of JSpecify (https://jspecify.dev/)
2929

3030
Following the lead of many other projects (including The Spring Framework), we have adopted JSpecify to fully
31-
document the null handling properties of this library. JSpecify is now a runtime dependency of this library - as is
31+
document the null handling properties of this library. JSpecify is now a runtime dependency - as is
3232
recommended practice with JSpecify.
3333

3434
This change should not impact the running of any existing code, but depending on your usage you may see new IDE or
@@ -43,7 +43,7 @@ this rule:
4343
2. Methods with names that include "WhenPresent" will properly handle null parameters
4444
(for example, "isEqualToWhenPresent")
4545

46-
As you might expect, standardizing null handling revealed some issues in the library that may impact you:
46+
As you might expect, standardizing null handling revealed some issues in the library that may impact you.
4747

4848
Fixing compiler warnings and errors:
4949

@@ -53,12 +53,35 @@ Fixing compiler warnings and errors:
5353
2. Java Classes that extend "AliasableSqlTable" will likely see IDE warnings about non-null type arguments. This can be
5454
resolved by adding a "@NullMarked" annotation to the class or package. This issue does not affect Kotlin classes
5555
that extend "AliasableSqlTable".
56+
3. Similarly, if you have coded any functions for use with your queries, you can resolve most IDE warnings by adding
57+
the "@NullMarked" annotation.
58+
4. If you have coded any Kotlin functions that operate on a generic Java class from the library, then you should
59+
change the type parameter definition to specify a non-nullable type. For example...
60+
61+
```kotlin
62+
import org.mybatis.dynamic.sql.SqlColumn
63+
64+
fun <T> foo(column: SqlColumn<T>) {
65+
}
66+
```
67+
68+
Should change to:
69+
70+
```kotlin
71+
import org.mybatis.dynamic.sql.SqlColumn
72+
73+
fun <T : Any> foo(column: SqlColumn<T>) {
74+
}
75+
```
5676

5777
Runtime behavior changes:
5878

5979
1. The where conditions (isEqualTo, isLessThan, etc.) can be filtered and result in an "empty" condition -
6080
similar to java.util.Optional. Previously, calling a "value" method of the condition would return null. Now
6181
those methods will throw "NoSuchElementException". This should not impact you in normal usage.
82+
2. We have updated the "ParameterTypeConverter" used in Spring applications to maintain compatibility with Spring's
83+
"Converter" interface. The primary change is that the framework will no longer call a type converter if the
84+
input value is null. This should simplify the coding of converters and foster reuse with existing Spring converters.
6285

6386
### Other important changes:
6487

src/main/java/org/mybatis/dynamic/sql/ParameterTypeConverter.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,13 @@
5252
*/
5353
@FunctionalInterface
5454
public interface ParameterTypeConverter<S, T> {
55+
/**
56+
* Convert the value from one value to another.
57+
*
58+
* <p>The input value will never be null - the framework will automatically handle nulls.
59+
*
60+
* @param source value as specified in the condition, or after a map operation. Never null.
61+
* @return Possibly null converted value.
62+
*/
5563
@Nullable T convert(S source);
5664
}

0 commit comments

Comments
 (0)