@Test public void http_204_turns_empty_body_into_alias_of_OptionalDouble() throws IOException { assertThat(emptyContainerDecoder.decode(HTTP_204, Alias3.class)).isEqualTo(Alias3.of(OptionalDouble.empty())); }
@Override public Object decode(Response response, Type type) throws IOException { Object delegateResult = delegate.decode(response, type); if (response.status() == 204 || (response.status() == 200 && delegateResult == null)) { @Nullable Object object = blankInstanceCache.get(type); return Preconditions.checkNotNull( object, "Received HTTP 204 but unable to construct an empty instance for return type", SafeArg.of("type", type)); } else { return delegateResult; } }
EmptyContainerDecoder implements Decoder { @Override public Object decode(Response response, Type type) throws IOException { Object delegateResult = delegate.decode(response, type); if (response.status() == 204 || (response.status() == 200 && delegateResult == null)) { @Nullable Object object = blankInstanceCache.get(type); return Preconditions.checkNotNull( object, "Received HTTP 204 but unable to construct an empty instance for return type", SafeArg.of("type", type)); } else { return delegateResult; } } }
EmptyContainerDecoder implements Decoder { @Override public Object decode(Response response, Type type) throws IOException { Object delegateResult = delegate.decode(response, type); if (response.status() == 204 || (response.status() == 200 && delegateResult == null)) { @Nullable Object object = blankInstanceCache.get(type); return Preconditions.checkNotNull( object, "Received HTTP 204 but unable to construct an empty instance for return type", SafeArg.of("type", type)); } else { return delegateResult; } } EmptyContainerDecoder(ObjectMapper mapper, Decoder delegate); }
EmptyContainerDecoder implements Decoder { @Override public Object decode(Response response, Type type) throws IOException { Object delegateResult = delegate.decode(response, type); if (response.status() == 204 || (response.status() == 200 && delegateResult == null)) { @Nullable Object object = blankInstanceCache.get(type); return Preconditions.checkNotNull( object, "Received HTTP 204 but unable to construct an empty instance for return type", SafeArg.of("type", type)); } else { return delegateResult; } } EmptyContainerDecoder(ObjectMapper mapper, Decoder delegate); @Override Object decode(Response response, Type type); }
EmptyContainerDecoder implements Decoder { @Override public Object decode(Response response, Type type) throws IOException { Object delegateResult = delegate.decode(response, type); if (response.status() == 204 || (response.status() == 200 && delegateResult == null)) { @Nullable Object object = blankInstanceCache.get(type); return Preconditions.checkNotNull( object, "Received HTTP 204 but unable to construct an empty instance for return type", SafeArg.of("type", type)); } else { return delegateResult; } } EmptyContainerDecoder(ObjectMapper mapper, Decoder delegate); @Override Object decode(Response response, Type type);  }