Package org.codehaus.jackson.map

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


                            true);
    StringWriter sw = new StringWriter();

    try
    {
      mapper.writeValue(sw, data);

      if (sw.toString().getBytes().length > ZNRecord.SIZE_LIMIT)
      {
        throw new HelixException("Data size larger than 1M. Write empty string to zk.");
      }
View Full Code Here


    // ByteArrayOutputStream baos = new ByteArrayOutputStream();
    StringWriter sw = new StringWriter();
    try
    {
      mapper.writeValue(sw, result);
      // System.out.println(sw.toString());

      ZNRecord zn = mapper.readValue(new StringReader(sw.toString()),
          ZNRecord.class);
      System.out.println(result.toString());
View Full Code Here

      System.out.println(zn.toString());
      AssertJUnit.assertTrue(zn.toString().equalsIgnoreCase(result.toString()));
      System.out.println();

      sw= new StringWriter();
      mapper.writeValue(sw, result2);

      ZNRecord zn2 = mapper.readValue(new StringReader(sw.toString()),
          ZNRecord.class);
      System.out.println(result2.toString());
      System.out.println(zn2.toString());
View Full Code Here

      System.out.println(result2.toString());
      System.out.println(zn2.toString());
      AssertJUnit.assertTrue(zn2.toString().equalsIgnoreCase(result2.toString()));

      sw= new StringWriter();
      mapper.writeValue(sw, result3);
      System.out.println();

      ZNRecord zn3 = mapper.readValue(new StringReader(sw.toString()),
          ZNRecord.class);
      System.out.println(result3.toString());
View Full Code Here

      {
        ObjectMapper mapper = new ObjectMapper();
        SerializationConfig serializationConfig = mapper.getSerializationConfig();
        serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);
        StringWriter sw = new StringWriter();
        mapper.writeValue(sw, _alertHistory);
        return sw.toString();
      }
      catch(Exception e)
      {
        _logger.warn("", e);
View Full Code Here

     
      ObjectMapper mapper = new ObjectMapper();
      StringWriter sw = new StringWriter();
      try
      {
        mapper.writeValue(sw, _updateMap);
      }
      catch (Exception e)
      {
        LOG.error("",e);
      }
View Full Code Here

          serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);

          StringWriter sw = new StringWriter();
          try
          {
            mapper.writeValue(sw, record);
            logger.info(sw.toString());
          } catch (Exception e)
          {
            logger.warn(
                    "Exception during serialization in ZKPathDataDumpTask.checkAndDump. This can mostly be ignored",
View Full Code Here

    ObjectMapper mapper = new ObjectMapper();
    SerializationConfig serializationConfig = mapper.getSerializationConfig();
    serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);

    StringWriter sw = new StringWriter();
    mapper.writeValue(sw, cr);

    String crString = sw.toString();

    schedulerMessage.getRecord().setSimpleField("Criteria", crString);
    schedulerMessage.getRecord().setMapField("MessageTemplate",
View Full Code Here

    ObjectMapper mapper = new ObjectMapper();
    SerializationConfig serializationConfig = mapper.getSerializationConfig();
    serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);

    StringWriter sw = new StringWriter();
    mapper.writeValue(sw, cr);

    String crString = sw.toString();

    schedulerMessage.getRecord().setSimpleField("Criteria", crString);
    schedulerMessage.getRecord().setMapField("MessageTemplate",
View Full Code Here

    ObjectMapper mapper = new ObjectMapper();
    SerializationConfig serializationConfig = mapper.getSerializationConfig();
    serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);

    StringWriter sw = new StringWriter();
    mapper.writeValue(sw, cr);

    String crString = sw.toString();

    schedulerMessage.getRecord().setSimpleField("Criteria", crString);
    schedulerMessage.getRecord().setMapField("MessageTemplate",
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.