I am attempting to deserialize a JSON sent from a REST application. This object needs to be deserialized into a 3rd party object that contains polymorphic methods. When I attempt to do the deserialization using jackson I get the following exception:
Conflicting setter definitions for property "system": ca.uhn.fhir.model.dstu2.composite.CodingDt#setSystem(1 params) vs ca.uhn.fhir.model.dstu2.composite.CodingDt#setSystem(1 params)
public CodingDt setSystem(UriDt theValue) {
mySystem = theValue;
return this;
}
public CodingDt setSystem( String theUri) {
mySystem = new UriDt(theUri);
return this;
}
I cannot modify the 3rd party class so used the Jackson MixIn as described in the ticket Jackson Mixin.This approach seems to work but there are many classes that this class refers to, that has the same exact problem. If I need to add a MixIn for each class, then I am ending up with a large number of MixIn's which is making the code less readable and hard to maintain.
Is there any global setting in Jackson that I can set, so that only one of the setters is used, or a setting to provide additional info to the deserailizer so that it does not complain.
I have use the PropertyNamingStrategy for Jackson as described in http://www.javaroots.com/2013/03/how-to-use-naming-in-jackson.html. Thanks to @bhdrkn
I also have to use the following code to ignore unknown properties for my code to work.