On Mon, Mar 27, 2023 at 2:15 PM Viktor Szathmáry <[email protected]> wrote: > > Hi, > > Is there a good way of applying the equivalent of INTERN_FIELD_NAMES but for > field values? I'm guessing a custom deserializer
There is no such functionality, although I think it has been requested. But design is more complicated due to typically different fields would need different handling (that is, only some should be canonicalized, and possibly as distinct value sets). > could be applied to these fields, but different implementations would need to > happen depending on the type of the underlying deserializer buffer (eg bytes > or chars). What would be a reasonable design for this? Right, it depends on what are important optimizations: if it is important to avoid intermediate String generation then things get more complicated. If not, then it could be handled by deserializer itself (accessing String, canonicalizing as second step). But there are different approaches even without String allocation: decoding from input can be done (and generally is) into intermediate `char[]` buffer, so callback could be used to get access to that buffer (and offset, length), to avoid allocation but without having to deal with UTF-8 (etc) decoding. For that there'd probably need to be addition of something like String getText(DecodingCallback cb); in JsonParser; that'd need to be implemented by various backends although would default to something simple (actually calling `getText()` or whatever). But that obviously would be a change to `jackson-core` and not something that can be done from outside. -+ Tatu +- > > Thanks, > Viktor > > -- > You received this message because you are subscribed to the Google Groups > "jackson-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jackson-user/b482520d-cc8e-4802-808f-7c117f16348en%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/CAL4a10jhvtax76oVieX7Rgfi_19ANv2XdZ4CcgMsYU2Zygr3aQ%40mail.gmail.com.
