I'm working on a Web Services Client to an application with both SOAP/XML and REST/JSON endpoints. Working from an API document with example JSON and a WSDL file I generated some Java Classes.
Both the JSON and JAXB generated class collections have some very similar classes. I would like to combine them if possible.
Here is the generated JSON version:
@JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({ "statusCode", "statusMessage" }) public class StatusInfo { @JsonProperty("statusCode") private Integer statusCode; @JsonProperty("statusMessage") private String statusMessage; @JsonIgnore private Map<String, Object> additionalProperties = new HashMap<String, Object>(); @JsonProperty("statusCode") public Integer getStatusCode() { return statusCode; } @JsonProperty("statusCode") public void setStatusCode(Integer statusCode) { this.statusCode = statusCode; } @JsonProperty("statusMessage") public String getStatusMessage() { return statusMessage; } @JsonProperty("statusMessage") public void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
and here is the generated JaxB version:
@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "StatusInfo", propOrder = { "statusCode", "statusMessage" }) public class StatusInfo { protected Integer statusCode; protected String statusMessage; public Integer getStatusCode() { return statusCode; } public void setStatusCode(Integer value) { this.statusCode = value; } public String getStatusMessage() { return statusMessage; } public void setStatusMessage(String value) { this.statusMessage = value; } }
These classes are in two separate packages, but have the same name and are virtually identical(aside from comments and annotations). How can I combine these into 1 StatusInfo class for the both the REST/JSON and the SOAP/XML portions of application to use?
No comments:
Post a Comment