You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: java-extension.md
+42-2Lines changed: 42 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -311,7 +311,7 @@ public class CustomizedSetter {
311
311
312
312
The setter parameters, constructor parameters and fields are all just bindings. Those bindings can be updated by extension, to change data source and decoder.
313
313
314
-
# Full extension interface
314
+
# Extension & Iterator
315
315
316
316
```
317
317
public interface Extension {
@@ -357,4 +357,44 @@ To summary it up, you have these options:
357
357
* the setters to use, and the parameter binding of setters
358
358
* all bindings (fields, setter parameters, constructor parameters) can change data source (even map to multiple fields) and change decoder
359
359
360
-
Also the decoder interface is powered with iterator-api to iterate on the lowest level. I believe all the flexibility you will ever need
360
+
Also the decoder interface is powered with iterator-api to iterate on the lowest level. I believe this should provide all the flexibility you will ever need. If you are still not on board, here is another shot.
361
+
362
+
There is a feature flag of jackson called `ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT`. The intention is to decode input like `[]` as null, as PHP might treat empty object as empty array. To support this feature, we can register a extension
Using iterator we can detect if input is `[]`, and act accordingly. If input is not array, we can even fallback to default behavior. It works like servlet filter, if one decoder can not handle it, it can fallback to the next one.
0 commit comments