Search in sources :

Example 1 with BadgerFishXMLStreamWriter

use of org.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter in project jersey by jersey.

the class Stax2JettisonFactory method createWriter.

public static XMLStreamWriter createWriter(final Writer writer, final JettisonConfig config) throws IOException {
    switch(config.getNotation()) {
        case BADGERFISH:
            return new BadgerFishXMLStreamWriter(writer);
        case MAPPED_JETTISON:
            Configuration jmConfig;
            if (null == config.getXml2JsonNs()) {
                jmConfig = new Configuration();
            } else {
                jmConfig = new Configuration(config.getXml2JsonNs());
            }
            final MappedXMLStreamWriter result = new MappedXMLStreamWriter(new MappedNamespaceConvention(jmConfig), writer);
            for (String array : config.getArrayElements()) {
                result.serializeAsArray(array);
            }
            return result;
        default:
            return null;
    }
}
Also used : Configuration(org.codehaus.jettison.mapped.Configuration) MappedXMLStreamWriter(org.codehaus.jettison.mapped.MappedXMLStreamWriter) MappedNamespaceConvention(org.codehaus.jettison.mapped.MappedNamespaceConvention) BadgerFishXMLStreamWriter(org.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter)

Aggregations

BadgerFishXMLStreamWriter (org.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter)1 Configuration (org.codehaus.jettison.mapped.Configuration)1 MappedNamespaceConvention (org.codehaus.jettison.mapped.MappedNamespaceConvention)1 MappedXMLStreamWriter (org.codehaus.jettison.mapped.MappedXMLStreamWriter)1