@Override public T deserialize(final HttpResponse httpResponse) { return delegate.deserialize(httpResponse); } }
@Nullable @Override public Pair<T, HttpResponse> deserialize(final HttpResponse httpResponse) { final T javaObject = delegate.deserialize(httpResponse); return ImmutablePair.of(javaObject, httpResponse); }
@Nullable @Override public Pair<T, JsonNode> deserialize(final HttpResponse httpResponse) { final JsonNode jsonNode = JsonNodeSphereRequest.of(delegate).deserialize(httpResponse); final T javaObject = delegate.deserialize(httpResponse); return ImmutablePair.of(javaObject, jsonNode); }
@Override public T deserialize(final HttpResponse httpResponse) { final List<String> deprecationNoticeHeaderValues = getDeprecationNoticeHeaderValues(httpResponse); if (deprecationNoticeHeaderValues.isEmpty()) { return sphereRequest.deserialize(httpResponse); } else { final SphereException sphereException = new SphereDeprecationException(deprecationNoticeHeaderValues); sphereException.setSphereRequest(sphereRequest); sphereException.setUnderlyingHttpResponse(httpResponse); throw sphereException; } }
@Override public T deserialize(final HttpResponse httpResponse) { final List<String> deprecationNoticeHeaderValues = getDeprecationNoticeHeaderValues(httpResponse); if (deprecationNoticeHeaderValues.isEmpty()) { return sphereRequest.deserialize(httpResponse); } else { final SphereException sphereException = new SphereDeprecationException(deprecationNoticeHeaderValues); sphereException.setSphereRequest(sphereRequest); sphereException.setUnderlyingHttpResponse(httpResponse); throw sphereException; } }
@Override public T deserialize(final HttpResponse httpResponse) { final List<String> deprecationNoticeHeaderValues = getDeprecationNoticeHeaderValues(httpResponse); if (deprecationNoticeHeaderValues.isEmpty()) { return sphereRequest.deserialize(httpResponse); } else { final SphereException sphereException = new SphereDeprecationException(deprecationNoticeHeaderValues); sphereException.setSphereRequest(sphereRequest); sphereException.setUnderlyingHttpResponse(httpResponse); throw sphereException; } }
static <T> T parse(final SphereRequest<T> sphereRequest, final ObjectMapper objectMapper, final SphereApiConfig config, final HttpResponse httpResponse, final HttpRequest httpRequest) { final T result; if (!sphereRequest.canDeserialize(httpResponse)) { final SphereException sphereException = createExceptionFor(httpResponse, sphereRequest, objectMapper, config, httpRequest); throw sphereException; } else { try { result = sphereRequest.deserialize(httpResponse); } catch (final JsonException e) { final byte[] bytes = httpResponse.getResponseBody(); e.addNote("Cannot parse " + bytesToString(bytes)); throw e; } } return result; }
static <T> T parse(final SphereRequest<T> sphereRequest, final ObjectMapper objectMapper, final SphereApiConfig config, final HttpResponse httpResponse) { final T result; if (!sphereRequest.canDeserialize(httpResponse)) { final SphereException sphereException = createExceptionFor(httpResponse, sphereRequest, objectMapper, config); throw sphereException; } else { try { result = sphereRequest.deserialize(httpResponse); } catch (final JsonException e) { final byte[] bytes = httpResponse.getResponseBody(); e.addNote("Cannot parse " + bytesToString(bytes)); throw e; } } return result; }
static <T> T parse(final SphereRequest<T> sphereRequest, final ObjectMapper objectMapper, final SphereApiConfig config, final HttpResponse httpResponse, final HttpRequest httpRequest) { final T result; if (!sphereRequest.canDeserialize(httpResponse)) { final SphereException sphereException = createExceptionFor(httpResponse, sphereRequest, objectMapper, config, httpRequest); throw sphereException; } else { try { result = sphereRequest.deserialize(httpResponse); } catch (final JsonException e) { final byte[] bytes = httpResponse.getResponseBody(); e.addNote("Cannot parse " + bytesToString(bytes)); throw e; } } return result; }