java - Reading json input on Jersey which can be both nullable and optional -
i have following rest end-point
@put @path("/props") public response update(props input) { .. }
and input parameter is:
@xmlaccessortype(xmlaccesstype.field) class props { public string prop1; public string prop2; }
client sends input json string. want both parameter nullable , optional. example: if client wants update prop2 null value without updating prop1 may send:
{"prop2":null}
but @ point see both input.prop1 = null
, input.prop2 = null
.
how can distinguish if client has sent prop null value or has not sent @ all?
isn’t better make empty string if want set null, , null if did not sent @ all?
Comments
Post a Comment