Examples of writerWithType()


Examples of org.codehaus.jackson.map.ObjectMapper.writerWithType()

  public static ObjectWriter createWriter(Type type)
  {
    ObjectMapper mapper = getObjectMapper(type);
    setGlobalConfigurations(mapper);
    JavaType paramJavaType = mapper.getTypeFactory().constructType(type);
    ObjectWriter writer = mapper.writerWithType(paramJavaType);
    return writer;
  }
 
  private static void setGlobalConfigurations(ObjectMapper mapper)
  {
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writerWithType()

        embedded.add(new Child2());
        input.setResult(embedded);
        mapper.configure(SerializationConfig.Feature.USE_STATIC_TYPING, true);

        JavaType rootType = TypeFactory.defaultInstance().constructType(new TypeReference<JSONResponse<List<Parent>>>() { });
        byte[] json = mapper.writerWithType(rootType).writeValueAsBytes(input);
//        byte[] json = mapper.writeValueAsBytes(input);

//        System.out.println("After Serialization: " + new String(json));
       
        JSONResponse<List<Parent>> out = mapper.readValue(json, 0, json.length, rootType);
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writerWithType()

        Map<String, PlatePool> pooledPlates = FormUtils.importPlateInputSpreadsheet(f, user, requestManager, libraryNamingScheme);

        ObjectMapper mapper = new ObjectMapper();
        mapper.getSerializationConfig().addMixInAnnotations(Sample.class, SampleRecursionAvoidanceMixin.class);

        String s = mapper.writerWithType(new TypeReference<Collection<PlatePool>>() {})
                         .writeValueAsString(pooledPlates.values());
        a.add(JSONArray.fromObject(s));
      }
      o.put("pools", a);
      log.info(o.toString());
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writerWithType()

        Map<String, PlatePool> pooledPlates = FormUtils.importPlateInputSpreadsheet(f, user, requestManager, libraryNamingScheme);

        ObjectMapper mapper = new ObjectMapper();
        mapper.getSerializationConfig().addMixInAnnotations(Sample.class, SampleRecursionAvoidanceMixin.class);

        String s = mapper.writerWithType(new TypeReference<Collection<PlatePool>>() {})
                         .writeValueAsString(pooledPlates.values());
        a.add(JSONArray.fromObject(s));
      }
      o.put("pools", a);
      log.info(o.toString());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.