本文整理了Java中com.mashape.unirest.http.Unirest.setObjectMapper()
方法的一些代码示例,展示了Unirest.setObjectMapper()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Unirest.setObjectMapper()
方法的具体详情如下:
包路径:com.mashape.unirest.http.Unirest
类名称:Unirest
方法名:setObjectMapper
[英]Set the ObjectMapper implementation to use for Response to Object binding
[中]将ObjectMapper实现设置为用于响应对象绑定
代码示例来源:origin: co.fingerprintsoft/notification-clickatell
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);
}
}
});
}
代码示例来源:origin: co.fingerprintsoft/notification-mailgun
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);
}
}
});
}
代码示例来源:origin: io.teecube.t3/t3-site-enhancer
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);
}
代码示例来源:origin: cdelmas/microservices-comparison
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);
}
}
});
}
代码示例来源:origin: us.ihmc/ihmc-ci-plugin-plugin
this.loginInfo = loginInfo;
Unirest.setObjectMapper(new ObjectMapper()
代码示例来源:origin: us.ihmc/ihmc-continuous-integration-core-tools
Unirest.setObjectMapper(new ObjectMapper()
代码示例来源:origin: io.joshworks/snappy
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);
}
});
}
代码示例来源:origin: de.adorsys.amp/amp-client
Unirest.setObjectMapper(objectMapper);
代码示例来源:origin: biezhi/java-library-examples
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();
内容来源于网络,如有侵权,请联系作者删除!