/** * Creates a new {@code RetrieveConnectionMetricsResponse} from a JSON object. * * @param jsonObject the JSON object of which the response is to be created. * @param dittoHeaders the headers of the response. * @return the response. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. */ public static RetrieveConnectionMetricsResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandResponseJsonDeserializer<RetrieveConnectionMetricsResponse>(TYPE, jsonObject).deserialize( statusCode -> { final String readConnectionId = jsonObject.getValueOrThrow(ConnectivityCommandResponse.JsonFields.JSON_CONNECTION_ID); final ConnectionMetrics readConnectionMetrics = ConnectivityModelFactory.connectionMetricsFromJson( jsonObject.getValueOrThrow(JSON_CONNECTION_METRICS)); return of(readConnectionId, readConnectionMetrics, dittoHeaders); }); }
/** * Creates a new {@code RetrieveConnectionMetricsResponse} from a JSON object. * * @param jsonObject the JSON object of which the response is to be created. * @param dittoHeaders the headers of the response. * @return the response. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. */ public static RetrieveConnectionMetricsResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandResponseJsonDeserializer<RetrieveConnectionMetricsResponse>(TYPE, jsonObject).deserialize( statusCode -> { final String readConnectionId = jsonObject.getValueOrThrow(ConnectivityCommandResponse.JsonFields.JSON_CONNECTION_ID); final ConnectionMetrics readConnectionMetrics = ConnectivityModelFactory.connectionMetricsFromJson( jsonObject.getValueOrThrow(JSON_CONNECTION_METRICS)); return of(readConnectionId, readConnectionMetrics, dittoHeaders); }); }