Package com.google.gwt.json.client

Examples of com.google.gwt.json.client.JSONString.stringValue()


          JSONValue value = JSONParser.parseLenient( responseText );
          JSONObject object = value.isObject();
          value = object.get( "timeZones" );
          JSONValue serverTZvalue = object.get( "serverTzId" );
          JSONString serverTZIdString = serverTZvalue.isString();
          String serverTZId = serverTZIdString.stringValue();
          object = value.isObject();
          value = object.get( "entry" );
          JSONArray timeZonesJSONArray = value.isArray();
          for ( int i = 0; i < timeZonesJSONArray.size(); i++ ) {
            JSONValue entryValue = timeZonesJSONArray.get( i );
View Full Code Here


        JSONArray stringValueArr = o.get( "stringValue" ).isArray();

        for ( int j = 0; j < stringValueArr.size(); j++ ) {
          urlParams += ( i == 0 && j == 0 ) ? "?" : "&";
          urlParams +=
              name.stringValue().replace( "\"", "" ) + "=" + stringValueArr.get( j ).toString().replace( "\"", "" );
        }
      }
      setParametersUrl( "api/repos/" + urlPath + "/parameterUi" + urlParams ); //$NON-NLS-1$ //$NON-NLS-2$
    }
    super.center();
View Full Code Here

        TreeItem child = treeItem.addItem(getChildText(key));
        addChildren(child, jsonObject.get(key));
      }
    } else if ((jsonString = jsonValue.isString()) != null) {
      // Use stringValue instead of toString() because we don't want escaping
      treeItem.addItem(SafeHtmlUtils.fromString(jsonString.stringValue()));
    } else {
      // JSONBoolean, JSONNumber, and JSONNull work well with toString().
      treeItem.addItem(getChildText(jsonValue.toString()));
    }
  }
View Full Code Here

    for (String key: keys) {
      JSONValue value = endpoint.get(key);
      if (value != null) {
        JSONString stringJsonVal = value.isString();
        if (stringJsonVal != null) {
          record.setAttribute(key, stringJsonVal.stringValue());
        }
      }
    }
   
    records.add(record);
View Full Code Here

  public String getAsString(JSONValue jsonValue) throws SparqlParseException {
    JSONString jsonString = jsonValue.isString();
    if (jsonString == null) {
      throw new SparqlParseException("Cannot format value as string");
    }
    return jsonString.stringValue();
  }
 
  public boolean getBooleanResult() {
    return booleanResult;
  }
View Full Code Here

    JSONArray jsonArray = jsonVal.isArray();
    if (jsonArray != null) {
      for (int i = 0; i < jsonArray.size(); i++) {
        JSONString value = jsonArray.get(i).isString();
        if (value != null) {
          result.add(value.stringValue());
        }
      }
    }
    return result;
  }
View Full Code Here

        final JSONString user = bd.get("user").isString();
        final JSONString host = bd.get("host").isString();
        final JSONString repo = bd.get("repo").isString();
        final JSONString version = bd.get("version").isString();
        build_data.setHTML(
          "OpenTSDB version [" + version.stringValue() + "] built from revision "
          + shortrev.stringValue()
          + " in a " + status.stringValue() + " state<br/>"
          + "Built on " + new Date((Long.parseLong(stamp.stringValue()) * 1000))
          + " by " + user.stringValue() + '@' + host.stringValue()
          + ':' + repo.stringValue());
View Full Code Here

            if (!err.isEmpty() && err.charAt(0) == '{') {
              final JSONValue json = JSONParser.parse(err);
              final JSONObject result = json == null ? null : json.isObject();
              final JSONValue jerr = result == null ? null : result.get("err");
              final JSONString serr = jerr == null ? null : jerr.isString();
              err = serr.stringValue();
              // If the error message has multiple lines (which is common if
              // it contains a stack trace), show only the first line and
              // hide the rest in a panel users can expand.
              final int newline = err.indexOf('\n', 1);
              final String msg = "Request failed: " + response.getStatusText();
View Full Code Here

        JSONNumber number = value.isNumber();
        if (number == null) {
            JSONString val = value.isString();
            if (val != null){
                try {
                    return Double.parseDouble(val.stringValue());
                }
                catch(NumberFormatException e){
                    // just through exception below
                }
            }
View Full Code Here

                    throw new DecodingException("Expected an entry key field not found");
                JSONString k = key.isString();
                if (k == null)
                    throw new DecodingException("Expected an entry key to be a string, but was given: " + value);

                rc.put(k.stringValue(), encoder.decode(entry.get("value")));
            }
            return rc;
        }
        default:
            throw new UnsupportedOperationException("The encoding style is not yet suppored: " + style.name());
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.