Package org.codehaus.jackson.map

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


      JsonMappingException,
      IOException
  {
    StringReader sr = new StringReader(jsonString);
    ObjectMapper mapper = new ObjectMapper();
    return mapper.readValue(sr, clazz);
  }

  @Test
  public void testAddDeleteClusterAndInstanceAndResource() throws Exception
  {
View Full Code Here


    String newIdealStateString = form.getFirstValue(NEW_IDEAL_STATE, true);

    if (newIdealStateString != null)
    {
      ZNRecord newIdealState =
          mapper.readValue(new StringReader(newIdealStateString), ZNRecord.class);
      _extraParameterMap.put(NEW_IDEAL_STATE, newIdealState);
    }

    String newStateModelString = form.getFirstValue(NEW_STATE_MODEL_DEF, true);
    if (newStateModelString != null)
View Full Code Here

    String newStateModelString = form.getFirstValue(NEW_STATE_MODEL_DEF, true);
    if (newStateModelString != null)
    {
      ZNRecord newStateModel =
          mapper.readValue(new StringReader(newStateModelString), ZNRecord.class);
      _extraParameterMap.put(NEW_STATE_MODEL_DEF, newStateModel);
    }
  }

  public String getParameter(String key)
View Full Code Here

    deserializationConfig.set(DeserializationConfig.Feature.AUTO_DETECT_FIELDS, true);
    deserializationConfig.set(DeserializationConfig.Feature.AUTO_DETECT_SETTERS, true);
    deserializationConfig.set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true);
    try
    {
      ZNRecord zn = mapper.readValue(bais, ZNRecord.class);
      return zn;
    } catch (Exception e)
    {
      logger.error("Exception during deserialization of bytes: " + new String(bytes), e);
      return null;
View Full Code Here

    deserializationConfig.set(DeserializationConfig.Feature.AUTO_DETECT_SETTERS, true);
    deserializationConfig.set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES,
                              true);
    try
    {
      T value = mapper.readValue(bais, _clazz);
      return value;
    }
    catch (Exception e)
    {
      LOG.error("Error during deserialization of bytes: " + new String(bytes), e);
View Full Code Here

    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());
      System.out.println(zn.toString());
      AssertJUnit.assertTrue(zn.toString().equalsIgnoreCase(result.toString()));
      System.out.println();
View Full Code Here

      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());
      AssertJUnit.assertTrue(zn2.toString().equalsIgnoreCase(result2.toString()));
View Full Code Here

      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());
      System.out.println(zn3.toString());
      AssertJUnit.assertTrue(zn3.toString().equalsIgnoreCase(result3.toString()));
      System.out.println();
View Full Code Here

            return;

        ObjectMapper m = new ObjectMapper();
        try
        {
            JsonNode rootNode = m.readValue(manifestFile, JsonNode.class);
            JsonNode generations = rootNode.get("generations");
            assert generations.isArray();
            for (JsonNode generation : generations)
            {
                int level = generation.get("generation").getIntValue();
View Full Code Here

    Response response = client.handle(request);
    Representation result = response.getEntity();
    StringWriter sw = new StringWriter();
    result.write(sw);
    ObjectMapper mapper = new ObjectMapper();
    ZNRecord zn = mapper.readValue(new StringReader(sw.toString()), ZNRecord.class);

    Map<String, String> paraMap = new HashMap<String, String>();

    paraMap.put(JsonParameters.MANAGEMENT_COMMAND,
                ClusterSetup.addStateModelDef);
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.