On Fri, May 25, 2018 at 3:16 AM,  <[email protected]> wrote:
> 2.7.9 does not work either :-(
> But I am bound to use 2.7.4 anyway.

Too bad wrt 2.7.9, although I am curious as to why you think you had
to use 2.7.4?
Patch releases are API-compatible with each other and there should not
be any reason why you
would need to align patches. This is different from major and minor
releases that should definitely match (major must,
minor versions should, although some of adjacent minor versions may work).

> And implementing ResolvableSerializer and ContextualSerializer in the
> following way still results in a NPE in WritableObjectId.writeAsField.
> BTW, why is the property in createContextual 'null'?

It will be `null` for "root value" serializer: the value given to
mapper which is not referenced by
a property. But since contextualization may still be needed (as it may
differ from serializers used for
values referenced by a property), method is still called.

>
> Any other ideas/suggestions?
>
> Thanks in advance.
>
> @Overridepublic void resolve(SerializerProvider serializerProvider) throws
> JsonMappingException {
>     if (defaultSerializer instanceof ResolvableSerializer) {
>         ((ResolvableSerializer)
> defaultSerializer).resolve(serializerProvider);
>     }
> }
>
> @Override
> public JsonSerializer<?> createContextual(SerializerProvider prov,
> BeanProperty property) throws JsonMappingException {
>     System.out.println("Property: " + property);
>     return defaultSerializer;
> }

^^^^^^^^^
you would need to delegate this similarly, and this is usually more
important of the two.
Did it not get called at all?

-+ Tatu +-

-- 
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 post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to