class Defaults {

    public static <T> BiFunction<HttpRequestBase, HttpResponse, T> convertResponse(ObjectMapper mapper,
            Class<T> clazz) {
        return (request, response) -> {
            try (final InputStream content = response.getEntity().getContent()) {
                final String contentAsString = IOUtils.toString(content, UTF_8);
                if (StringUtils.isEmpty(contentAsString)) {
                    return null;
                } else {
                    return mapper.readerFor(clazz).readValue(contentAsString);
                }
            } catch (IOException e) {
                throw new TDPException(CommonErrorCodes.UNEXPECTED_EXCEPTION, e);
            } finally {
                request.releaseConnection();
            }
        };
    }

    private  Defaults();

}