Example usage for com.fasterxml.jackson.dataformat.xml XmlMapper setInjectableValues

List of usage examples for com.fasterxml.jackson.dataformat.xml XmlMapper setInjectableValues

Introduction

In this page you can find the example usage for com.fasterxml.jackson.dataformat.xml XmlMapper setInjectableValues.

Prototype

public ObjectMapper setInjectableValues(InjectableValues injectableValues) 

Source Link

Document

Method for configuring InjectableValues which used to find values to inject.

Usage

From source file:org.apache.olingo.client.core.serialization.ClientODataDeserializerImpl.java

protected XmlMapper getXmlMapper() {
    final XmlMapper xmlMapper = new XmlMapper(new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()),
            new JacksonXmlModule());

    xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(Boolean.class, Boolean.FALSE));

    xmlMapper.addHandler(new DeserializationProblemHandler() {
        @Override/*from   w  w w. ja  v a2  s  . c o  m*/
        public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser jp,
                final com.fasterxml.jackson.databind.JsonDeserializer<?> deserializer, final Object beanOrClass,
                final String propertyName) throws IOException, JsonProcessingException {

            // skip any unknown property
            ctxt.getParser().skipChildren();
            return true;
        }
    });
    return xmlMapper;
}