Skip to content

Commit b3b3b7d

Browse files
committed
Documentation
1 parent 42a905c commit b3b3b7d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ Runtime behavior changes:
8282
2. We have updated the "ParameterTypeConverter" used in Spring applications to maintain compatibility with Spring's
8383
"Converter" interface. The primary change is that the framework will no longer call a type converter if the
8484
input value is null. This should simplify the coding of converters and foster reuse with existing Spring converters.
85+
3. The "map" method on the "WhenPresent" conditions will accept a mapper function that may return a null value. The
86+
conditions will now properly handle this outcome
8587

8688
### Other important changes:
8789

Diff for: src/site/markdown/docs/conditions.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ table lists the optional conditions and shows how to use them:
166166
| Null | where(id, isNull().filter(BooleanSupplier) | The condition will render if BooleanSupplier.getAsBoolean() returns true |
167167

168168
### "When Present" Condition Builders
169-
The library supplies several methods that supply conditions to be used in the common case of checking for null
170-
values. The table below lists the rendering rules for each of these "when present" condition builder methods.
169+
The library supplies conditions for use in the common case of checking for null
170+
values. The table below lists the rendering rules for each of these "when present" conditions.
171171

172172
| Condition | Example | Rendering Rules |
173173
|---------------------------|---------------------------------------------------|---------------------------------------------------------------|
@@ -184,14 +184,20 @@ values. The table below lists the rendering rules for each of these "when presen
184184
| Not Like | where(id, isNotLikeWhenPresent(x)) | The condition will render if x is non-null |
185185
| Not Like Case Insensitive | where(id, isNotLikeCaseInsensitiveWhenPresent(x)) | The condition will render if x is non-null |
186186

187-
Note that these methods simply apply a "NotNull" filter to a condition. For example:
187+
With our adoption of JSpecify, it is now considered a misuse of the library to pass a null value into a condition
188+
unless the condition is one of the "when present" conditions. If you previously wrote code like this:
188189

189190
```java
190-
// the following two lines are functionally equivalent
191-
... where (id, isEqualToWhenPresent(x)) ...
192191
... where (id, isEqualTo(x).filter(Objects::nonNull)) ...
193192
```
194193

194+
Starting in version 2.0.0 of the library, you will now see IDE warnings related to nullability. You should change it
195+
to this:
196+
197+
```java
198+
... where (id, isEqualToWhenPresent(x)) ...
199+
```
200+
195201
### Optionality with the "In" Conditions
196202
Optionality with the "in" and "not in" conditions is a bit more complex than the other types of conditions. The rules
197203
are different for the base conditions ("isIn", "isNotIn", etc.) and the "when present" conditions ("isInWhenPresent",

0 commit comments

Comments
 (0)