Closed haribachala closed 6 years ago
Correct, this causes conflict currently because wrapper handling/resolution occurs at a later point, after duplicate checking. It is a problem.
Thanks,
is there any work around will suggest to come out of this problem. the above code working with 1.9 version of Jackson.
Unfortunately I am not aware of a work-around for this problem.
The following Workaround will work for conflict issue.
Annotate Getter Method with @Jsonproperty("Name").
@Jsonproperty("Address" @XmlElement(name="Address") public List
getOfficeAddresses() { return officeAddresses; }I've found a workaround for this issue
List<Address> officeAddresses;
List<Address> residenceAddresses;
@XmlElementWrapper(name="ResidenceAddress")
@XmlElements(@XmlElement(name="Address"))
public List<Address> getResidenceAddresses() {
return residenceAddresses;
}
@XmlElementWrapper(name="OfficeAddress")
@XmlElements(@XmlElement(name="Address"))
public List<Address> getOfficeAddresses() {
return officeAddresses;
}
@godgav Thank you for sharing your workaround.
@godgav +1 for the workaround :)
I found I needed a little more meta before I got closer to what I needed:
@JsonProperty("outstandingProofs")
@XmlElementWrapper(name = "outstandingProofs")
@XmlElements(@XmlElement(name = "proof", type = TypeOneProofRequirement.class))
public List<ProofRequirement> getTypeOneProofs() {
return proofs;
}
Consumes this:
<outstandingProofs>
<proof>
<!-- ... -->
</proof>
</outstandingProofs>
Produces this:
"outstandingProofs" : [ {
"proof" : {
...
}
} ]
Project has moved, so although I think problem exists in some form, would need to be re-filed at:
Hi when two properties having Different @XmlElementWrapper names and same @XmlElement name then exception occurring.
Exception: Caused by: java.lang.IllegalArgumentException: Conflicting getter definitions for property "Address" example:
How to handle this kind of things ?
eg:
Not able create JSON Response for Above cases using Jackson.
Jettison working fine for above kind of issues.