Package com.fasterxml.jackson.databind

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


  }

  public void setResult(Object result) {
    if (result != null) {
      ObjectMapper mapper = JOM.getInstance();
      resp.put("result", mapper.convertValue(result, JsonNode.class));
      setError(null);
    }
    else {
      if (resp.has("result")) {
        resp.remove("result");
View Full Code Here


    return resp.get("result");
  }

  public <T> T getResult(Class<T> type) {
    ObjectMapper mapper = JOM.getInstance();
    return mapper.convertValue(resp.get("result"), type);
  }

  public void setError(JSONRPCException error) {
    if (error != null) {
      resp.put("error", error.getObjectNode());
View Full Code Here

          } else {
            String name = getName(p);
            if (name != null) {
              // this is a named parameter
              if (paramsObject.has(name)) {
                objects[i] = mapper.convertValue(
                    paramsObject.get(name), p.getType());
              } else {
                if (isRequired(p)) {
                  throw new Exception("Required parameter '"
                      + name + "' missing");
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

          } else {
            String name = getName(p);
            if (name != null) {
              // this is a named parameter
              if (paramsObject.has(name)) {
                objects[i] = mapper.convertValue(
                    paramsObject.get(name), p.getType());
              } else {
                if (isRequired(p)) {
                  throw new ClassCastException(
                      "Required parameter '" + name
View Full Code Here

    setParams(params);
  }
 
  public final 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 final void setMethod(String method) {
    req.put("method", method);
  }
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.