// [#438]: Support @JsonProperty.index public void testPropertyIndex() throws Exception { BeanDescription beanDesc = mapper.getDeserializationConfig().introspect(mapper.constructType(PropDescBean.class)); _verifyProperty(beanDesc, false, true); beanDesc = mapper.getSerializationConfig().introspect(mapper.constructType(PropDescBean.class)); _verifyProperty(beanDesc, false, true); }
// [#269]: Support new @JsonPropertyDescription public void testPropertyDesc() throws Exception { // start via deser BeanDescription beanDesc = mapper.getDeserializationConfig().introspect(mapper.constructType(PropDescBean.class)); _verifyProperty(beanDesc, true, false); // and then via ser: beanDesc = mapper.getSerializationConfig().introspect(mapper.constructType(PropDescBean.class)); _verifyProperty(beanDesc, true, false); }
// for [JACKSON-701] public void testInnerClassWithAnnotationsInCreator() throws Exception { BasicBeanDescription beanDesc; // first with serialization beanDesc = mapper.getSerializationConfig().introspect(mapper.constructType(Issue701Bean.class)); assertNotNull(beanDesc); // then with deserialization beanDesc = mapper.getDeserializationConfig().introspect(mapper.constructType(Issue701Bean.class)); assertNotNull(beanDesc); }
protected POJOPropertiesCollector collector( ObjectMapper m0, Class<?> cls, boolean forSerialization) { BasicClassIntrospector bci = new BasicClassIntrospector(); // no real difference between serialization, deserialization, at least here if (forSerialization) { return bci.collectProperties( m0.getSerializationConfig(), m0.constructType(cls), null, true, "set"); } return bci.collectProperties( m0.getDeserializationConfig(), m0.constructType(cls), null, false, "set"); }
public void testJackson744() throws Exception { BeanDescription beanDesc = mapper.getDeserializationConfig().introspect(mapper.constructType(Issue744Bean.class)); assertNotNull(beanDesc); AnnotatedMethod setter = beanDesc.findAnySetter(); assertNotNull(setter); }
@SuppressWarnings("hiding") public void testJackson703() throws Exception { // note: need a separate mapper, need to reconfigure ObjectMapper mapper = new ObjectMapper(); mapper.configure(MapperFeature.USE_ANNOTATIONS, false); BasicBeanDescription beanDesc = mapper.getSerializationConfig().introspect(mapper.constructType(Jackson703.class)); assertNotNull(beanDesc); Jackson703 bean = new Jackson703(); String json = mapper.writeValueAsString(bean); assertNotNull(json); }
// [databind#938] public void testRecursivePair() throws Exception { JavaType t = MAPPER.constructType(ImmutablePair.class); assertNotNull(t); assertEquals(ImmutablePair.class, t.getRawClass()); List<ImmutablePair<String, Double>> list = new ArrayList<ImmutablePair<String, Double>>(); list.add(ImmutablePair.of("Hello World!", 123d)); String json = MAPPER.writeValueAsString(list); assertNotNull(json); // can not deserialize with current definition, however }