Package com.fasterxml.jackson.databind

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


   *            the new data
   */
  public final void setData(final Object data) {
    final ObjectMapper mapper = JOM.getInstance();
    error.put(DATA_S,
        data != null ? mapper.convertValue(data, JsonNode.class) : null);
  }
 
  /**
   * Gets the data.
   *
 
View Full Code Here


        "type", "and",
        "havingSpecs", ImmutableList.of(greaterMap, orMap)
    );

    ObjectMapper mapper = new DefaultObjectMapper();
    assertEquals(andHavingSpec,  mapper.convertValue(payloadMap, AndHavingSpec.class));
  }

  @Test
  public void testGreaterThanHavingSpec() {
    GreaterThanHavingSpec spec = new GreaterThanHavingSpec("metric", 10.003);
View Full Code Here

    // Convert the result to a map.
    ObjectMapper mapper = new ObjectMapper();
    // We need to suppress Java's type erasure. :(
    @SuppressWarnings("unchecked")
    Map<String, Object> metaData =
      mapper.convertValue(schema, Map.class);
   
    // Remove the schema from the meta-data.
    metaData.remove(Schema.JSON_KEY_SCHEMA);
   
    // Save the meta-data.
View Full Code Here

     
      // Attempt to get the meta-data;
      MetaData metaData = null;
      JsonNode metaDataNode = dataObject.get(Data.JSON_KEY_METADATA);
      if(metaDataNode != null) {
        metaData = mapper.convertValue(metaDataNode, MetaData.class);
      }
     
      // Attempt to get the schema data.
      JsonNode schemaData = dataObject.get(Data.JSON_KEY_DATA);
     
View Full Code Here

    setParams(params);
  }

  public void setId(Object id) {
    ObjectMapper mapper = JOM.getInstance();
    req.put("id", mapper.convertValue(id, JsonNode.class));
  }

  public Object getId() {
    ObjectMapper mapper = JOM.getInstance();
    return mapper.convertValue(req.get("id"), Object.class);
View Full Code Here

    req.put("id", mapper.convertValue(id, JsonNode.class));
  }

  public Object getId() {
    ObjectMapper mapper = JOM.getInstance();
    return mapper.convertValue(req.get("id"), Object.class);
  }

  public void setMethod(String method) {
    req.put("method", method);
  }
View Full Code Here

  }

  public void putParam(String name, Object value) {
    ObjectMapper mapper = JOM.getInstance();
    req.with("params")
        .put(name, mapper.convertValue(value, JsonNode.class));
  }

  public Object getParam(String name) {
    ObjectMapper mapper = JOM.getInstance();
    ObjectNode params = req.with("params");
View Full Code Here

  public Object getParam(String name) {
    ObjectMapper mapper = JOM.getInstance();
    ObjectNode params = req.with("params");
    if (params.has(name)) {
      return mapper.convertValue(params.get(name), Object.class);
    }
    return null;
  }

  public Object hasParam(String name) {
View Full Code Here

  }
 
  public void setData(Object data) {
    ObjectMapper mapper = JOM.getInstance();
    // TODO: test if convert value works
    error.put("data", data != null ? mapper.convertValue(data, JsonNode.class) : null);
  }
 
  public Object getData() {
    return error.get("data");
  }
View Full Code Here

    setError(error);
  }
 
  public void setId(Object id) {
    ObjectMapper mapper = JOM.getInstance();
    resp.put("id", mapper.convertValue(id, JsonNode.class));
  }

  public Object getId() {
    ObjectMapper mapper = JOM.getInstance();
    return mapper.convertValue(resp.get("id"), JsonNode.class);
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.