Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.AnnotationIntrospector


   
    protected POJOPropertiesCollector collectPropertiesWithBuilder(MapperConfig<?> config,
            JavaType type, MixInResolver r, boolean forSerialization)
    {
        boolean useAnnotations = config.isAnnotationProcessingEnabled();
        AnnotationIntrospector ai = useAnnotations ? config.getAnnotationIntrospector() : null;
        AnnotatedClass ac = AnnotatedClass.construct(type.getRawClass(), ai, r);
        JsonPOJOBuilder.Value builderConfig = (ai == null) ? null : ai.findPOJOBuilderConfig(ac);
        String mutatorPrefix = (builderConfig == null) ? "with" : builderConfig.withPrefix;
        return constructPropertyCollector(config, ac, type, forSerialization, mutatorPrefix).collect();
    }
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 static String getName(PropertyNamingStrategy naming, BeanPropertyDefinition beanProperty,
                                MapperConfig<?> config) {

    AnnotationIntrospector annotationIntrospector = config.isAnnotationProcessingEnabled()
            ? config.getAnnotationIntrospector()
            : null;
    POJOPropertyBuilder prop = new POJOPropertyBuilder(beanProperty.getName(), annotationIntrospector, true);
    return naming.nameForField(config, prop.getField(), beanProperty.getName());
  }
View Full Code Here

    private void _testListSerialization(boolean useWrapping) throws Exception
    {
        JacksonXmlModule module = new JacksonXmlModule();
        module.setDefaultUseWrapper(useWrapping);
        XmlMapper xmlMapper = new XmlMapper(module);
        AnnotationIntrospector introspector = new JacksonAnnotationIntrospector();
        xmlMapper.setAnnotationIntrospector(introspector);

        SampleResource r1 = new SampleResource();
        r1.setId(123L);
        r1.setName("Albert");
View Full Code Here

    private void _testArraySerialization(boolean useWrapping) throws Exception
    {
        JacksonXmlModule module = new JacksonXmlModule();
        module.setDefaultUseWrapper(useWrapping);
        XmlMapper xmlMapper = new XmlMapper(module);
        AnnotationIntrospector introspector = new JacksonAnnotationIntrospector();
        xmlMapper.setAnnotationIntrospector(introspector);

        SampleResource r1 = new SampleResource();
        r1.setId(123L);
        r1.setName("Albert");
View Full Code Here

    public void testElementWrapper() throws Exception
    {
        XmlMapper _jaxbMapper = new XmlMapper();
        // Use JAXB-then-Jackson annotation introspector
        AnnotationIntrospector intr = XmlAnnotationIntrospector.Pair.instance
            (new XmlJaxbAnnotationIntrospector(TypeFactory.defaultInstance()),
                    new JacksonAnnotationIntrospector());
        _jaxbMapper.setAnnotationIntrospector(intr);

        MyPerson person = new MyPerson();
View Full Code Here

    public void setUp() throws Exception {
        super.setUp();
        _jaxbMapper = new XmlMapper();
        _nonJaxbMapper = new XmlMapper();
        // Use JAXB-then-Jackson annotation introspector
        AnnotationIntrospector intr = XmlAnnotationIntrospector.Pair.instance
            (new XmlJaxbAnnotationIntrospector(TypeFactory.defaultInstance()), new JacksonAnnotationIntrospector());
        _jaxbMapper.setAnnotationIntrospector(intr);
    }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.AnnotationIntrospector

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.