public ClickatellSMSSender(ClickatellSettings settings, ObjectMapper objectMapper) { this.settings = settings; this.objectMapper = objectMapper; Unirest.setObjectMapper(new com.mashape.unirest.http.ObjectMapper() { public <T> T readValue(String value, Class<T> valueType) { try { return objectMapper.readValue(value, valueType); } catch (IOException e) { throw new RuntimeException(e); } } public String writeValue(Object value) { try { return objectMapper.writeValueAsString(value); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }); }
public MailGunSender(MailGunSettings mailGunSettings, com.fasterxml.jackson.databind.ObjectMapper objectMapper) { this.mailGunSettings = mailGunSettings; this.objectMapper = objectMapper; Unirest.setObjectMapper(new ObjectMapper() { public <T> T readValue(String value, Class<T> valueType) { try { return objectMapper.readValue(value, valueType); } catch (IOException e) { throw new RuntimeException(e); } } public String writeValue(Object value) { try { return objectMapper.writeValueAsString(value); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }); }
private void init() throws IOException, UnirestException { mapper = new ObjectMapper() { private com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper = new com.fasterxml.jackson.databind.ObjectMapper(); public <T> T readValue(String value, Class<T> valueType) { try { jacksonObjectMapper.registerModule(new JodaModule()); return jacksonObjectMapper.readValue(value, valueType); } catch (IOException e) { throw new RuntimeException(e); } } public String writeValue(Object value) { try { return jacksonObjectMapper.writeValueAsString(value); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }; Unirest.setObjectMapper(mapper); }
private static void configureUnirest(final ObjectMapper objectMapper) { Unirest.setObjectMapper(new com.mashape.unirest.http.ObjectMapper() { @Override public <T> T readValue(String value, Class<T> valueType) { try { return objectMapper.readValue(value, valueType); } catch (IOException e) { throw new UncheckedIOException(e); } } @Override public String writeValue(Object value) { try { return objectMapper.writeValueAsString(value); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }); }
this.loginInfo = loginInfo; Unirest.setObjectMapper(new ObjectMapper()
Unirest.setObjectMapper(new ObjectMapper()
static void init() { Options.refresh(); JsonParser jsonParser = new JsonParser(); Unirest.setObjectMapper(new ObjectMapper() { @Override public <T> T readValue(String value, Class<T> valueType) { return jsonParser.readValue(value, valueType); } @Override public String writeValue(Object value) { return jsonParser.writeValue(value); } }); }
Unirest.setObjectMapper(objectMapper);
public static void main(String[] args) throws UnirestException { Unirest.setObjectMapper(new ObjectMapper() { private com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper = new com.fasterxml.jackson.databind.ObjectMapper();