Package org.codehaus.jackson.map.introspect

Examples of org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector


        }
    }

    private static ObjectMapper getMapper() {
        ObjectMapper jacksonMapper = new ObjectMapper();
        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        jacksonMapper.setAnnotationIntrospector(primary);
        jacksonMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        jacksonMapper.registerModule(new MrBeanModule());
        return jacksonMapper;
    }
View Full Code Here


        }
        if (mapper == null) {
            mapper = new ObjectMapper();
        }
        AnnotationIntrospector primary = new JaxbAnnotationIntrospector();
        AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector pair = new AnnotationIntrospector.Pair(primary, secondary);
        mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
        mapper.getDeserializationConfig().set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
        mapper.getSerializationConfig().setAnnotationIntrospector(pair);
        mapper.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
View Full Code Here

                    }
                }
            }
        }
        AnnotationIntrospector primary = new JaxbAnnotationIntrospector();
        AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector pair = new AnnotationIntrospector.Pair(primary, secondary);
        mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
        // [rfeng] To avoid complaints about javaClass
        mapper.getDeserializationConfig().set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, Boolean.FALSE);
        mapper.getSerializationConfig().setAnnotationIntrospector(pair);
View Full Code Here

        if (mapper == null) {
            mapper = new ObjectMapper();
            //mapper.registerModule(new JsonOrgModule());
        }
        // Let's honor the Jackson annotations first
        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        AnnotationIntrospector secondary = new JaxbAnnotationIntrospector();
        AnnotationIntrospector pair = new AnnotationIntrospector.Pair(primary, secondary);
        mapper.setDeserializationConfig(mapper.getDeserializationConfig().withAnnotationIntrospector(pair)
            .without(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES)
            .withDateFormat(StdDateFormat.getBlueprintISO8601Format()));
View Full Code Here

    public WinkJacksonJaxbJsonProvider() {
        ObjectMapper mapper = new ObjectMapper();
        mapper.getSerializationConfig().setSerializationInclusion(Inclusion.NON_NULL);
        AnnotationIntrospector pair =
            new AnnotationIntrospector.Pair(new JaxbAnnotationIntrospector(),
                                            new JacksonAnnotationIntrospector());
        mapper.getDeserializationConfig().setAnnotationIntrospector(pair);
        mapper.getSerializationConfig().setAnnotationIntrospector(pair);
        this.jacksonProvider = new JacksonJaxbJsonProvider();
        jacksonProvider.setMapper(mapper);
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    public void testSimple()
    {
        // null -> no mix-in annotations
        AnnotatedClass ac = AnnotatedClass.construct(SubClass.class, new JacksonAnnotationIntrospector(), null);
        ac.resolveMemberMethods(BasicClassIntrospector.DEFAULT_GETTER_FILTER);
        ac.resolveCreators(true);
        ac.resolveFields();

        assertNotNull(ac.getDefaultConstructor());
View Full Code Here

     */
    @SuppressWarnings("deprecation")
    public void testGenericsWithSetter()
    {
        // null -> no mix-in annotations
        AnnotatedClass ac = AnnotatedClass.construct(NumberBean.class, new JacksonAnnotationIntrospector(), null);
        ac.resolveMemberMethods(BasicClassIntrospector.DEFAULT_SETTER_FILTER);
        assertEquals(1, ac.getMemberMethodCount());

        Iterator<AnnotatedMethod> it = ac.memberMethods().iterator();
        AnnotatedMethod am = it.next();
View Full Code Here

    }

    public void testFieldIntrospection()
    {
        // null -> no mix-in annotations
        AnnotatedClass ac = AnnotatedClass.construct(FieldBean.class, new JacksonAnnotationIntrospector(), null);
        ac.resolveFields();
        /* 14-Jul-2009, tatu: AnnotatedClass does remove forcibly ignored
         *   entries, but will still contain non-public fields too (earlier
         *   versions didn't, but filtering was moved to a later point)
         */
 
View Full Code Here

    }

    public void testDefaultNonNull() throws Exception
    {
        ObjectMapper mapper = new ObjectMapper();
        mapper.setAnnotationIntrospector(new JacksonAnnotationIntrospector());
        mapper.setSerializationInclusion(Inclusion.NON_NULL);
        assertEquals("{\"value\":\"abc\"}", mapper.writeValueAsString(new NullBean<String>("abc")));
        assertEquals("{}", mapper.writeValueAsString(new NullBean<String>(null)));
    }
View Full Code Here

  @Override
  public ObjectMapper locateMapper(Class<?> type, MediaType mediaType) {
    ObjectMapper mapper = super.locateMapper(type, mediaType);
    AnnotationIntrospector introspector = new AnnotationIntrospector.Pair(
        new JaxbAnnotationIntrospector(),
        new JacksonAnnotationIntrospector()
    );
    mapper.setAnnotationIntrospector(introspector);
    //mapper.setSerializationInclusion(Inclusion.NON_NULL);
    return mapper;
  }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector

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.