// [#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);
 }
 public void testJackson744() throws Exception {
   BeanDescription beanDesc =
       mapper.getDeserializationConfig().introspect(mapper.constructType(Issue744Bean.class));
   assertNotNull(beanDesc);
   AnnotatedMethod setter = beanDesc.findAnySetter();
   assertNotNull(setter);
 }
 // [#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");
 }
Ejemplo n.º 6
0
 protected TypeNameIdResolver createTypeNameIdResolver(boolean forSerialization) {
   Collection<NamedType> subtypes = new ArrayList<NamedType>();
   subtypes.add(new NamedType(MapHolder.class, "mapHolder"));
   subtypes.add(new NamedType(ArrayList.class, "AList"));
   subtypes.add(new NamedType(HashMap.class, "HMap"));
   ObjectMapper mapper = new ObjectMapper();
   return TypeNameIdResolver.construct(
       mapper.getDeserializationConfig(),
       TypeFactory.defaultInstance().constructType(Object.class),
       subtypes,
       forSerialization,
       !forSerialization);
 }