com.aliyun.datahub.client.http.provider.JsonContextProvider Maven / Gradle / Ivy
package com.aliyun.datahub.client.http.provider;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
@Provider
public class JsonContextProvider implements ContextResolver {
private final ObjectMapper mapper;
public JsonContextProvider() {
mapper = new ObjectMapper();
// mapper.enable(SerializationFeature.INDENT_OUTPUT);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
}
public ObjectMapper getContext(Class> aClass) {
return mapper;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy