本文整理汇总了Java中com.mashape.unirest.http.ObjectMapper类的典型用法代码示例。如果您正苦于以下问题:Java ObjectMapper类的具体用法?Java ObjectMapper怎么用?Java ObjectMapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObjectMapper类属于com.mashape.unirest.http包,在下文中一共展示了ObjectMapper类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import com.mashape.unirest.http.ObjectMapper; //导入依赖的package包/类
/**
* Configure, <code>AIRTABLE_API_KEY</code> passed by Java property,
* enviroment variable or within credentials.properties.
*
* @param objectMapper A custom ObjectMapper implementation
* @return An Airtable instance configured with supplied ObjectMapper
* @throws com.sybit.airtable.exception.AirtableException Missing API-Key
*/
@SuppressWarnings("UnusedReturnValue")
public Airtable configure(ObjectMapper objectMapper) throws AirtableException {
LOG.info("System-Property: Using Java property '-D" + AIRTABLE_API_KEY + "' to get apikey.");
String airtableApi = System.getProperty(AIRTABLE_API_KEY);
if (airtableApi == null) {
LOG.info("Environment-Variable: Using OS environment '" + AIRTABLE_API_KEY + "' to get apikey.");
airtableApi = System.getenv(AIRTABLE_API_KEY);
}
if (airtableApi == null) {
airtableApi = getCredentialProperty(AIRTABLE_API_KEY);
}
return this.configure(airtableApi, objectMapper);
}
示例2: BotConnectorClientFactory
import com.mashape.unirest.http.ObjectMapper; //导入依赖的package包/类
private BotConnectorClientFactory() {
Unirest.setObjectMapper(new ObjectMapper() {
@Override
public <T> T readValue(String s, Class<T> aClass) {
return SerializerFacade.fromJsonString(aClass, s);
}
@Override
public String writeValue(Object o) {
return SerializerFacade.toJsonString(o.getClass(), o);
}
});
}
示例3: JacksonObjectMapper
import com.mashape.unirest.http.ObjectMapper; //导入依赖的package包/类
public JacksonObjectMapper() {
jacksonObjectMapper = new com.fasterxml.jackson.databind.ObjectMapper()
.disable(FAIL_ON_UNKNOWN_PROPERTIES);
}
示例4: KintoClient
import com.mashape.unirest.http.ObjectMapper; //导入依赖的package包/类
/**
* {@link KintoClient} constructor that allows to specify a remote kinto installation as well as an
* {@link ObjectMapper} that will allow unmarshalling of responses as objects (that must be properly annotated
* with jackson annotations).
* @param remote The remote URL. Must contain the version
* @param objectMapper {@link ObjectMapper} to use for deserialization
* @throws IllegalArgumentException if remote is null or an empty String or if headers is null
*/
public KintoClient(String remote, ObjectMapper objectMapper) {
this(remote);
Unirest.setObjectMapper(objectMapper);
}