I have a class in which I use the jersey client to deserialize. This class has a method that looks like this:
public boolean isEmpty() {
return (code == null &&
label == null &&
codeSystem == null &&
codeSystemLabel == null &&
description == null &&
concept == null &&
alternateCode == null
);
No setter. As-is, this will throw this exception:
com.sun.jersey.api.client.ClientHandlerException: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "empty" (Class com.app.models.CodedElementModel), not marked as ignorable
at [Source: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@3b927d51; line: 1, column: 270] (through reference chain: com.app.models.LabOrderModel["code"]->com.app.models.CodedElementModel["empty"])
I read this article , and it turns out I can fix it by putting this annotation to the class CodedElementModel: @JsonIgnoreProperties(ignoreUnknown = true).
, , . , , @JsonIgnoreProperties(ignoreUnknown = true) , ? ~ 30 , . , - .
-:
DefaultClientConfig clientConfig = new DefaultClientConfig();
clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
Client client = Client.create(clientConfig);
, clientConfig , , .