コード例 #1
0
 // [#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);
 }
コード例 #2
0
 // [#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);
 }
コード例 #3
0
 // 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);
 }
コード例 #4
0
 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");
 }
コード例 #5
0
  @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);
  }