private SecretImpl wrapModel(SecretItem inner) { if (inner == null) { return null; } SerializerAdapter<?> serializer = vault.manager().inner().restClient().serializerAdapter(); try { return wrapModel(serializer.<SecretBundle>deserialize(serializer.serialize(inner), SecretBundle.class)); } catch (IOException e) { return null; } }
private SecretImpl wrapModel(SecretItem inner) { if (inner == null) { return null; } SerializerAdapter<?> serializer = vault.manager().inner().restClient().serializerAdapter(); try { return wrapModel(serializer.<SecretBundle>deserialize(serializer.serialize(inner), SecretBundle.class)); } catch (IOException e) { return null; } }
@Override public <THeader> ServiceResponseWithHeaders<T, THeader> buildWithHeaders(final Response<ResponseBody> response, Class<THeader> headerType) throws IOException { ServiceResponse<T> bodyResponse = build(response); THeader headers = serializerAdapter.deserialize( serializerAdapter.serialize(Maps.asMap(response.headers().names(), new Function<String, String>() { @Override public String apply(String s) { return response.headers().get(s); } })), headerType); return new ServiceResponseWithHeaders<>(bodyResponse.body(), headers, bodyResponse.response()); }
@Override public <THeader> ServiceResponseWithHeaders<T, THeader> buildEmptyWithHeaders(final Response<Void> response, Class<THeader> headerType) throws IOException { ServiceResponse<T> bodyResponse = buildEmpty(response); THeader headers = serializerAdapter.deserialize( serializerAdapter.serialize(Maps.asMap(response.headers().names(), new Function<String, String>() { @Override public String apply(String s) { return response.headers().get(s); } })), headerType); ServiceResponseWithHeaders<T, THeader> serviceResponse = new ServiceResponseWithHeaders<>(headers, bodyResponse.headResponse()); serviceResponse.withBody(bodyResponse.body()); return serviceResponse; }