Not 100% sure I understand the question, but if you want to access
information about annotations on property, from your custom
serializer, you need to implement `ContextualSerializer`, and then its
`createContextual()` gets called with `BeanProperty`.
`BeanProperty` has accessors for annotation dir
Hi!
What I meant is that I would like to get (or create ) the default Jackson
Serializer for the object being serialized, and store as default.
Then I could implement serialize as follows:
@Override
public void serialize(Object o, JsonGenerator jg, SerializerProvider sp)
throws IOException {
This can not be done from annotation-based serializer: it will
override default logic.
The only way to access what would otherwise be created/used as the
standard serializer is to register `BeanSerializerModifier`, and
override handling of `modifySerializer`.
-+ Tatu +-
On Mon, Mar 20, 2017 at 1
Hi!
OK, thanks, then I'll go that way!
BR, Zsolt
2017. március 20., hétfő 20:13:25 UTC+1 időpontban Tatu Saloranta a
következőt írta:
>
> This can not be done from annotation-based serializer: it will
> override default logic.
> The only way to access what would otherwise be created/used as t
Good luck! That approach is used quite a lot so it should work fine.
Note, too, that it may be combined with ContextualSerializer if you do
need to access annotations.
In fact you can use `createContextual()` sometimes to simply decide if
override is needed at all; if not, return default serializer
Hi!
This is exactly what I was wondering... if there is a way to automate the
default serializer injection, when the custom serializer gets detected.
I am also willing to contribute to the code, if I am provided some guidance.
BR, Zsolt
2017. március 20., hétfő 21:24:27 UTC+1 időpontban Tatu Sa
This article points out exactly the fact, that the usage of
BeanSerializerModifier makes in unnecessary to use the annotation!
So I would happily contribute to make the @JsonSerialize smarter. :)
BR, Zsolt
2017. március 21., kedd 8:25:51 UTC+1 időpontban Zsolt Balanyi a következőt
írta:
>
> Hi!
http://stackoverflow.com/questions/31056215/how-to-access-default-jackson-serialization-in-a-custom-serializer
2017. március 21., kedd 9:16:17 UTC+1 időpontban Zsolt Balanyi a következőt
írta:
>
> This article points out exactly the fact, that the usage of
> BeanSerializerModifier makes in unnec