FasterXML / FasterXML/jackson-future-ideas
Add overridable isFieldNull() method to JsonSerializer<T>
- Dominant language
- No language data
- Stars
- 21
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
I've created a little 'sensitive data hiding' class that's basically a wrapper class with a custom` toString()` method.
To make this work with existing classes I registered a custom serialiser that unpacks the value and passes it on. This works great, and if the field is null, the `Include.NON_NULL` works great as well.
However, when the value inside the wrapper is null, it doesn't get picked up and it still serialises to `"fieldname":null`. To get around this I have to implement the `isEmpty()` method in the custom serialiser and use `Include.NON_EMPTY` on the class that uses the wrapper. This is not bad, but maybe it would be nice to either be able to specify when a field can be considered null with a `isFieldNull()` or something similar, so you can keep on using NON_NULL and not accidentally remove other fields for being an empty string for example.
I would understand if you'd rather keep it this way to not bloat the interface, but I thought I'd share the idea.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.