Also worth noting that Java8/Scala/Guava Option(al) works that way if one initializes value properly: `null` becomes "empty", missing leaves default value as whatever it is (Java `null`, for example). I think this is how it works via Creator parameters as well.
-+ Tatu +- On Wed, May 2, 2018 at 12:41 AM, Ruwen Schwedewsky < [email protected]> wrote: > Hi! > > Good to hear, but for the case other people have similar issues: > https://github.com/messagemedia/mm-jackson-support > > Maven central will follow. > > Cheers > Ruwen > > On 30/04/18 13:13, Garret Wilson wrote: > > Actually the situation I described works just fine for me. (I had been > looking at the wrong place in the log, so I incorrectly thought it wasn't > working.) > > In the case above, if the incoming JSON has no `flag` specified, my POJO > `FooBar.flag` is left to `null`, so I know not to update anything. > Otherwise, if the `Optional<>` is set to `true` or `false`, I know I need > to update to that value. If the value is `Optional.empty()`, I know that > the incoming JSON had `flag` set to `null` indicating the value should be > deleted, so I remove the value from the database. > > It's a bit roundabout and semantically suspect, but it's not a horrible > hack and it works. > -- > You received this message because you are subscribed to the Google Groups > "jackson-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "jackson-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jackson-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
