Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectMapper.writeValue()


        vo.values.put("key2", 2000l);
        vo.vo2.name = "testvoname2";
        vo.pods = "abcde";

        try {
            mapper.writeValue(writer, vo);
        } catch (JsonGenerationException e) {
            e.printStackTrace();
        } catch (JsonMappingException e) {
            e.printStackTrace();
        } catch (IOException e) {
View Full Code Here


        assertEquals(resource, fromto);

        ObjectMapper mapper = new ObjectMapper();

        StringWriter writer = new StringWriter();
        mapper.writeValue(writer, resourceTO);

        assertEquals(resourceTO, mapper.readValue(writer.toString(), ResourceTO.class));

        List<ResourceTO> resourceTOs = resourceDataBinder.getResourceTOs(resourceDAO.findAll());
        assertNotNull(resourceTOs);
View Full Code Here

        List<ResourceTO> resourceTOs = resourceDataBinder.getResourceTOs(resourceDAO.findAll());
        assertNotNull(resourceTOs);
        assertFalse(resourceTOs.isEmpty());

        writer = new StringWriter();
        mapper.writeValue(writer, resourceTOs);

        ResourceTO[] actual = mapper.readValue(writer.toString(), ResourceTO[].class);
        assertEquals(resourceTOs, Arrays.asList(actual));
    }
View Full Code Here

        prop.getEnumValues().put("key2", "value2");

        ObjectMapper mapper = new ObjectMapper();

        StringWriter writer = new StringWriter();
        mapper.writeValue(writer, prop);

        WorkflowFormPropertyTO unserializedProp = mapper.readValue(writer.toString(), WorkflowFormPropertyTO.class);
        assertEquals(prop, unserializedProp);
    }
View Full Code Here

        report.getReportletConfs().add(new UserReportletConf("second"));

        ObjectMapper mapper = new ObjectMapper();

        StringWriter writer = new StringWriter();
        mapper.writeValue(writer, report);

        ReportTO actual = mapper.readValue(writer.toString(), ReportTO.class);
        assertEquals(report, actual);
    }
}
View Full Code Here

   * @throws IOException Signals that an I/O exception has occurred.
   */
  private void writeObject(final java.io.ObjectOutputStream out) throws IOException {
    final ObjectMapper mapper = new ObjectMapper();
    mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
    mapper.writeValue(out, req);
  }
 
  /**
   * Read object.
   *
 
View Full Code Here

  }

  private void writeObject(java.io.ObjectOutputStream out) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
    mapper.writeValue(out, req);
  }

  private void readObject(java.io.ObjectInputStream in) throws IOException,
      ClassNotFoundException {
    ObjectMapper mapper = new ObjectMapper();
View Full Code Here

  }
 
  private void writeObject(java.io.ObjectOutputStream out) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false);
    mapper.writeValue(out, req);
  }
 
  private void readObject(java.io.ObjectInputStream in) throws IOException,
      ClassNotFoundException {
    ObjectMapper mapper = new ObjectMapper();
View Full Code Here

    @SuppressWarnings({"unchecked"})
    public HttpClientResponse request(String method, String path, Map<String, Object> data) {
        ObjectMapper mapper = new ObjectMapper();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            mapper.writeValue(out, data);
        } catch (IOException e) {
            throw new ElasticsearchException("", e);
        }
        return request(method, path, out.toByteArray());
    }
View Full Code Here

        ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
        JsonGenerator jsonGenerator = objectMapper.getFactory().createGenerator(
            bos, JsonEncoding.UTF8);

        if (jsonView == null) {
          objectMapper.writeValue(jsonGenerator, responseObject);
        }
        else {
          objectMapper.writerWithView(jsonView).writeValue(jsonGenerator,
              responseObject);
        }
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.