Examples of Stax2JacksonWriter


Examples of com.sun.jersey.json.impl.writer.Stax2JacksonWriter

                if (config.isHumanReadableFormatting()) {
                    rawGenerator.useDefaultPrettyPrinter();
                }
                final JsonGenerator bodyGenerator = writingList ? JacksonArrayWrapperGenerator.createArrayWrapperGenerator(rawGenerator, config.isRootUnwrapping() ? 0 : 1) : rawGenerator;
                if (config.isRootUnwrapping()) {
                    return new Stax2JacksonWriter(JacksonRootStrippingGenerator.createRootStrippingGenerator(bodyGenerator, writingList ? 2 : 1), config, expectedType, jaxbContext);
                } else {
                    return new Stax2JacksonWriter(bodyGenerator, config, expectedType, jaxbContext);
                    }
            case MAPPED:
                return JsonXmlStreamWriter.createWriter(writer, config, JSONHelper.getRootElementName((Class<Object>) expectedType));
            case BADGERFISH:
                return new BadgerFishXMLStreamWriter(writer);
View Full Code Here

Examples of com.sun.jersey.json.impl.writer.Stax2JacksonWriter

        StringWriter resultWriter = new StringWriter();

        JsonFactory jsonFactory = new JsonFactory();
        JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(resultWriter);

        final Stax2JacksonWriter writer = configuration != null
                ? new Stax2JacksonWriter(jsonGenerator, configuration, clazz, jaxbContext) : new Stax2JacksonWriter(jsonGenerator, clazz, jaxbContext);

        marshaller.marshal(jaxbBean, writer);
        System.out.println(String.format("Marshalled: %s", resultWriter.toString()));
        assertEquals("MISMATCH:\n" + expectedJsonExpr + "\n" + resultWriter.toString() + "\n",
                normalizeJsonString(expectedJsonExpr), normalizeJsonString(resultWriter.toString()));
View Full Code Here

Examples of com.sun.jersey.json.impl.writer.Stax2JacksonWriter

        JsonGenerator g;

        g = factory.createJsonGenerator(sWriter);

        Marshaller marshaller = ctx.createMarshaller();
        marshaller.marshal(bean, new Stax2JacksonWriter(g, clazz, ctx));

        g.flush();

        String jsonExpression = sWriter.toString();
        System.out.println(jsonExpression);
View Full Code Here

Examples of com.sun.jersey.json.impl.writer.Stax2JacksonWriter

        final JsonFactory factory = new JsonFactory();
        final Writer sWriter = new StringWriter();
        final JsonGenerator jsonGenerator = factory.createJsonGenerator(sWriter);

        final Marshaller marshaller = context.createMarshaller();
        marshaller.marshal(testInstance, new Stax2JacksonWriter(jsonGenerator, clazz, context));

        jsonGenerator.flush();
        return sWriter.toString();
    }
View Full Code Here

Examples of com.sun.jersey.json.impl.writer.Stax2JacksonWriter

        g = factory.createJsonGenerator(sWriter);

        Marshaller marshaller = ctx.createMarshaller();
//        marshaller.marshal(bean, System.out);
        marshaller.marshal(bean, new Stax2JacksonWriter(g));

        g.flush();

        String jsonExpression = sWriter.toString();
        System.out.println(jsonExpression);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.