We are serializing/deserializing JSON using jackson 2.11.0 and using
visibility settings to force the use of field-level access instead of via
setter/getters:
mapper.setVisibility(PropertyAccessor.FIELD,
JsonAutoDetect.Visibility.ANY);
mapper.setVisibility(PropertyAccessor.GETTER,
JsonAutoDetect.Visibility.NONE);
However, certain 3rdparty classes have specific properties that we want
generated by getter methods, and not the raw field value. We cannot modify
these classes directly. I tried doing a mixin to make this happen but
never figured it out. I'd prefer not to write a custom
serializer/deserializer for this use case if possible.
Here's a simplified example: If a create a Foo object (below) and serialize
it, I'd like the output to be: {"bar": "XXbarXX"}
public class Foo {
private String bar = "bar";
public String getBar() {
return "XX" + bar + "XX";
}
}
--
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/3f6f090a-f168-4f38-bb98-7b04b65e2e8bn%40googlegroups.com.