Package com.fasterxml.jackson.dataformat.xml

Examples of com.fasterxml.jackson.dataformat.xml.JacksonXmlModule


    }

    @Override
    protected void initXmlModule() {
        if (xmlTextElementName != null && !xmlTextElementName.isEmpty()) {
            xmlModule = new JacksonXmlModule();
            xmlModule.setXMLTextElementName(xmlTextElementName);
        }
    }
View Full Code Here


    @Override
    protected void initXmlModule() {
        if (defaultUseWrapper != null) {
            if (defaultUseWrapper.equals("false")) {
                xmlModule = new JacksonXmlModule();
                xmlModule.setDefaultUseWrapper(false);
            } else if (defaultUseWrapper.equals("true")) {
                //default value is already true, so nothing to do
            } else {
                throw SupportLogger.LOGGER.invalidReaderWriterProperty(defaultUseWrapper, "defaultUseWrapper");
View Full Code Here

@Component(value = "xmlMapper")
public class XmlMapper {

    public com.fasterxml.jackson.dataformat.xml.XmlMapper getXmlMapper(){
        JacksonXmlModule module = new JacksonXmlModule();
        module.setDefaultUseWrapper(true);
       
        com.fasterxml.jackson.dataformat.xml.XmlMapper mapper = new com.fasterxml.jackson.dataformat.xml.XmlMapper(module);
        mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
        mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
       
View Full Code Here

    @Override
    protected void initXmlModule() {
        if (defaultUseWrapper != null) {
            if (defaultUseWrapper.equals("false")) {
                xmlModule = new JacksonXmlModule();
                xmlModule.setDefaultUseWrapper(false);
            } else if (defaultUseWrapper.equals("true")) {
                //default value is already true, so nothing to do
            } else {
                throw SupportLogger.LOGGER.invalidReaderWriterProperty(null, defaultUseWrapper, "defaultUseWrapper");
View Full Code Here

    }

    @Override
    protected void initXmlModule() {
        if (xmlTextElementName != null && !xmlTextElementName.isEmpty()) {
            xmlModule = new JacksonXmlModule();
            xmlModule.setXMLTextElementName(xmlTextElementName);
        }
    }
View Full Code Here

                xmlFactory = xmlFactoryCached;
                if (xmlFactory == null) {
                    xmlFactoryCached = xmlFactory = new XmlFactory();
                }

                JacksonXmlModule xmlModule = null;
                NoMappingJsonFactoryObjectFactory.configureInputDecoratorAndOutputDecorator(xmlFactory, environment);

                final Object xmlTextElementName = environment.get("xmlTextElementName");
                if (xmlTextElementName != null) {
                    xmlModule = new JacksonXmlModule();
                    xmlModule.setXMLTextElementName((String) xmlTextElementName);
                }

                final Object defaultUseWrapper = environment.get("defaultUseWrapper");
                if (defaultUseWrapper != null) {
                    if (defaultUseWrapper.equals("false")) {
                        if (xmlModule == null) {
                            xmlModule = new JacksonXmlModule();
                        }
                        xmlModule.setDefaultUseWrapper(false);
                    } else if (defaultUseWrapper.equals("true")) {
                        //default value is already true, so nothing to do
                    } else {
                        throw SupportLogger.LOGGER.invalidReaderWriterProperty(null, (String) defaultUseWrapper, "defaultUseWrapper");
                    }
View Full Code Here

    @Override
    public synchronized XmlMapper getDefaultMapper()
    {
        if (_defaultMapper == null) {
            // 10-Oct-2012, tatu: Better do things explicitly...
            JacksonXmlModule module = getConfiguredModule();
            _defaultMapper = (module == null) ? new XmlMapper() : new XmlMapper(module);
            _setAnnotations(_defaultMapper, _defaultAnnotationsToUse);
        }
        return _defaultMapper;
    }
View Full Code Here

        return _defaultMapper;
    }

    protected JacksonXmlModule getConfiguredModule()
    {
        return new JacksonXmlModule();
    }
View Full Code Here

public class XmlMapperProvider implements Provider<XmlMapper>{

    @Override
    public XmlMapper get() {
       
        JacksonXmlModule module = new JacksonXmlModule();
        // Check out: https://github.com/FasterXML/jackson-dataformat-xml
        // setDefaultUseWrapper produces more similar output to
        // the Json output. You can change that with annotations in your
        // models.
        module.setDefaultUseWrapper(false);
       
        XmlMapper xmlMapper = new XmlMapper(module);
        xmlMapper.registerModule(new AfterburnerModule());

       
View Full Code Here

        // /////////////////////////////////////////////////////////////////////
        String response = ninjaTestBrowser.makeXmlRequest(getServerAddress()
                + "api/bob@gmail.com/articles.xml");
        System.out.println("response xml: " + response);
       
        JacksonXmlModule module = new JacksonXmlModule();
        // and then configure, for example:
        module.setDefaultUseWrapper(false);
        XmlMapper xmlMapper = new XmlMapper(module);
       

        ArticlesDto articlesDto = xmlMapper.readValue(response, ArticlesDto.class);
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.dataformat.xml.JacksonXmlModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.