Search in sources :

Example 1 with TreeMarshallingStrategy

use of com.thoughtworks.xstream.core.TreeMarshallingStrategy in project camel by apache.

the class DefaultCompositeApiClient method configureXStream.

static XStream configureXStream() {
    final PureJavaReflectionProvider reflectionProvider = new PureJavaReflectionProvider(new FieldDictionary(new AnnotationFieldKeySorter()));
    final XppDriver hierarchicalStreamDriver = new XppDriver(new NoNameCoder()) {

        @Override
        public HierarchicalStreamWriter createWriter(final Writer out) {
            return new CompactWriter(out, getNameCoder());
        }
    };
    final XStream xStream = new XStream(reflectionProvider, hierarchicalStreamDriver);
    xStream.aliasSystemAttribute(null, "class");
    xStream.ignoreUnknownElements();
    XStreamUtils.addDefaultPermissions(xStream);
    xStream.registerConverter(new DateTimeConverter());
    xStream.setMarshallingStrategy(new TreeMarshallingStrategy());
    xStream.processAnnotations(ADDITIONAL_TYPES);
    return xStream;
}
Also used : AnnotationFieldKeySorter(org.apache.camel.component.salesforce.api.dto.AnnotationFieldKeySorter) TreeMarshallingStrategy(com.thoughtworks.xstream.core.TreeMarshallingStrategy) CompactWriter(com.thoughtworks.xstream.io.xml.CompactWriter) XppDriver(com.thoughtworks.xstream.io.xml.XppDriver) XStream(com.thoughtworks.xstream.XStream) FieldDictionary(com.thoughtworks.xstream.converters.reflection.FieldDictionary) DateTimeConverter(org.apache.camel.component.salesforce.api.utils.DateTimeConverter) NoNameCoder(com.thoughtworks.xstream.io.naming.NoNameCoder) HierarchicalStreamWriter(com.thoughtworks.xstream.io.HierarchicalStreamWriter) ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) Writer(java.io.Writer) CompactWriter(com.thoughtworks.xstream.io.xml.CompactWriter) PureJavaReflectionProvider(com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider)

Aggregations

ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 XStream (com.thoughtworks.xstream.XStream)1 FieldDictionary (com.thoughtworks.xstream.converters.reflection.FieldDictionary)1 PureJavaReflectionProvider (com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider)1 TreeMarshallingStrategy (com.thoughtworks.xstream.core.TreeMarshallingStrategy)1 HierarchicalStreamWriter (com.thoughtworks.xstream.io.HierarchicalStreamWriter)1 NoNameCoder (com.thoughtworks.xstream.io.naming.NoNameCoder)1 CompactWriter (com.thoughtworks.xstream.io.xml.CompactWriter)1 XppDriver (com.thoughtworks.xstream.io.xml.XppDriver)1 Writer (java.io.Writer)1 AnnotationFieldKeySorter (org.apache.camel.component.salesforce.api.dto.AnnotationFieldKeySorter)1 DateTimeConverter (org.apache.camel.component.salesforce.api.utils.DateTimeConverter)1