FasterXML / FasterXML/jackson-future-ideas

Add overridable isFieldNull() method to JsonSerializer<T>

Abierto
#27 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Sin datos de lenguaje
Estrellas
21
Forks
3
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.