Java Code Examples for org.codehaus.jackson.map.ObjectMapper#setDeserializationConfig()

The following examples show how to use org.codehaus.jackson.map.ObjectMapper#setDeserializationConfig() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ObjectMapperResolver.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
public ObjectMapperResolver() throws Exception {
    mapper = new ObjectMapper();

    final AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector();
    final SerializationConfig serializationConfig = mapper.getSerializationConfig();
    final DeserializationConfig deserializationConfig = mapper.getDeserializationConfig();

    mapper.setSerializationConfig(serializationConfig.withSerializationInclusion(Inclusion.NON_NULL).withAnnotationIntrospector(jaxbIntrospector));
    mapper.setDeserializationConfig(deserializationConfig.withAnnotationIntrospector(jaxbIntrospector));
}
 
Example 2
Source File: ObjectMapperResolver.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
public ObjectMapperResolver() throws Exception {
    mapper = new ObjectMapper();

    final AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector();
    final SerializationConfig serializationConfig = mapper.getSerializationConfig();
    final DeserializationConfig deserializationConfig = mapper.getDeserializationConfig();

    mapper.setSerializationConfig(serializationConfig.withSerializationInclusion(Inclusion.NON_NULL).withAnnotationIntrospector(jaxbIntrospector));
    mapper.setDeserializationConfig(deserializationConfig.withAnnotationIntrospector(jaxbIntrospector));
}
 
Example 3
Source File: ObjectMapperResolver.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
public ObjectMapperResolver() throws Exception {
    mapper = new ObjectMapper();

    final AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector();
    final SerializationConfig serializationConfig = mapper.getSerializationConfig();
    final DeserializationConfig deserializationConfig = mapper.getDeserializationConfig();

    mapper.setSerializationConfig(serializationConfig.withSerializationInclusion(Inclusion.NON_NULL).withAnnotationIntrospector(jaxbIntrospector));
    mapper.setDeserializationConfig(deserializationConfig.withAnnotationIntrospector(jaxbIntrospector));
}
 
Example 4
Source File: BaseService.java    From docker-maven-plugin with Apache License 2.0 5 votes vote down vote up
public BaseService(String dockerApiRoot, String endPointPath) {
    objectMapper = new ObjectMapper();
    // Only send properties that are actually set, default values are often wrong
    objectMapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
    // If the API changes, we might get new properties that we do not know
    DeserializationConfig deserializationConfig = objectMapper.getDeserializationConfig()
            .without(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES);
    objectMapper.setDeserializationConfig(deserializationConfig);
    serviceEndPoint = createDockerTarget(dockerApiRoot)
            .path(TARGET_DOCKER_API_VERSION)
            .path(endPointPath);
}
 
Example 5
Source File: JenkinsHttpClient.java    From verigreen with Apache License 2.0 4 votes vote down vote up
private ObjectMapper getDefaultMapper() {
    ObjectMapper mapper = new ObjectMapper();
    DeserializationConfig deserializationConfig = mapper.getDeserializationConfig();
    mapper.setDeserializationConfig(deserializationConfig.without(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES));
    return mapper;
}