Changed serialized/deserialized value of enum with mixin

169 views
Skip to first unread message

Michael Harris

unread,
Dec 2, 2016, 5:41:42 PM12/2/16
to jackson-user
Hi all

We have an interesting issue where we are using one model and two json schemas.  We have had good luck using ObjectMapper.addMixin to basically set up the translation of the model for the relevant schema.  Now we have an issue where we need to translate Enum values between the two schemas.

So 

public enum MyEnum1 { none }

might translate to 

public enum MyEnum2 { ABSENT }

I'm pretty sure I can't use anything that annotates the model, as that would affect both json schemas.  Is there anyway to use a mixin to do this?  I have a working solution wtih BeanDeserializerModifier, but was wondering if this could be done with a mixin.  

Thanx!

Tatu Saloranta

unread,
Dec 5, 2016, 1:03:28 PM12/5/16
to jackso...@googlegroups.com
Could explain the intent in bit more detail? I am not 100% sure I
understand the goal.
Are you hoping to generate 2 different JSON Schemas out of one set of classes?
And as to Enums, are you trying to just change string serialization of
enum values, or do something more?

-+ Tatu +-

>
> Thanx!
>
> --
> 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 jackson-user...@googlegroups.com.
> To post to this group, send email to jackso...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages