Package com.fasterxml.jackson.module.jaxb

Examples of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector


        filterProvider.setFailOnUnknownId(false);
        mapper.setFilters(filterProvider);

        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector secondary =
            new JaxbAnnotationIntrospector(mapper.getTypeFactory());
        AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary);
        mapper.setAnnotationIntrospector(pair);
    }
View Full Code Here


    static ObjectMapper getObjectMapper(Configuration config) {
        ObjectMapper mapper = new ObjectMapper();
        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector secondary =
            new JaxbAnnotationIntrospector(mapper.getTypeFactory());
        AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary);

        mapper.setAnnotationIntrospector(pair);
        mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
View Full Code Here

    }

    public static ObjectMapper getMapper() {
        ObjectMapper mapper = new ObjectMapper();
        AnnotationIntrospector aipair = new AnnotationIntrospectorPair (
            new JaxbAnnotationIntrospector(),
            new JacksonAnnotationIntrospector()
        );
        mapper.setAnnotationIntrospector(aipair);
        //REMOVE: mapper.configure(SerializationConfig.Feature.USE_ANNOTATIONS, true);
        mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
View Full Code Here

    }

    public static ObjectMapper createObjectMapperWithIntroSpectors() {
        ObjectMapper mapper = new ObjectMapper();
        AnnotationIntrospector primaryIntrospector = new JacksonAnnotationIntrospector();
        AnnotationIntrospector secondaryIntrospector = new JaxbAnnotationIntrospector(mapper.getTypeFactory());
        AnnotationIntrospector introspector =
            new AnnotationIntrospectorPair(primaryIntrospector, secondaryIntrospector);
        mapper.getDeserializationConfig().withAppendedAnnotationIntrospector(introspector);
        mapper.getSerializationConfig().withAppendedAnnotationIntrospector(introspector);
        return mapper;
View Full Code Here

     *
     * @return {@link com.fasterxml.jackson.databind.ObjectMapper}
     */
    public static ObjectMapper createMapperWithJaxbAnnotationInspector() {
        ObjectMapper mapper = new ObjectMapper();
        AnnotationIntrospector annotationInspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
        mapper.getSerializationConfig().with(annotationInspector);
        return mapper;
    }
View Full Code Here

    private ObjectMapper newObjectMapper()
    {
        return new ObjectMapper()
            .setAnnotationIntrospector(new AnnotationIntrospectorPair(new JacksonAnnotationIntrospector(),
                new JaxbAnnotationIntrospector(TypeFactory.defaultInstance())));
    }
View Full Code Here

    public void testTwoAttributes() throws IOException
    {
        XmlMapper mapper = new XmlMapper();
//        mapper.setAnnotationIntrospector(new XmlJaxbAnnotationIntrospector(TypeFactory.defaultInstance()));
        mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()));
        String xml = mapper.writeValueAsString(new Jurisdiction());
        assertEquals("<Jurisdiction name=\"Foo\" value=\"13\"/>", xml);
    }
View Full Code Here

    }

    public void testAttributeAndElement() throws IOException
    {
        XmlMapper mapper = new XmlMapper();
        mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()));
        String xml = mapper.writeValueAsString(new Problem("x", "Stuff"));
        assertEquals("<problem id=\"x\"><description>Stuff</description></problem>", xml);
    }
View Full Code Here

    private static ObjectMapper createObjectMapper()
    {
        return new ObjectMapper()
            .setAnnotationIntrospector(new AnnotationIntrospectorPair(new JacksonAnnotationIntrospector(),
                new JaxbAnnotationIntrospector(TypeFactory.defaultInstance())));
    }
View Full Code Here

    private static ObjectMapper createObjectMapper()
    {
        return new ObjectMapper()
            .setAnnotationIntrospector(new AnnotationIntrospectorPair(new JacksonAnnotationIntrospector(),
                new JaxbAnnotationIntrospector(TypeFactory.defaultInstance())));
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector

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.